Jhe - java mail problem
Hi Jhe,
Hope you are fine.
I tried to create a mail session using the j2eetutorial14 examples.I did all the necessary settings like giving the mailhost name,defining JNDI name etc as per specification.But its throwing the following error please help me to solve this problem.
Feb 15, 2007 12:28:16 PM com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: development3.s4indsoft.com; p
ort: 3700"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2257)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2278)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:208)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:221)
at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java
:104)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:
152)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:146)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:286)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:89)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:128)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:288)
at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:725)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:132)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:286)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at ConfirmerClient.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:237)
at com.sun.enterprise.appclient.Main.<init>(Main.java:430)
at com.sun.enterprise.appclient.Main.main(Main.java:99)
Caused by: java.lang.RuntimeException: java.nio.channels.UnresolvedAddressException
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:336)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:191)
... 22 more
Caused by: java.nio.channels.UnresolvedAddressException
at sun.nio.ch.Net.checkAddress(Net.java:30)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:451)
at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:320)
... 23 more
Thanks & Regards,
R.Ramesh.
This says it all.
Feb 15, 2007 12:28:16 PM com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: development3.s4indsoft.com; p
ort: 3700"
MeTitus
Similar Messages
-
I want to used java mail api code in sun application server.But i hava a problem with configuration about HOST:
String from = "[email protected]";
String host = "http://localhost:4848/";
Properties props = new Properties();
props.put("mail.smtp.host", host);Nayana,
host name should be your mail server name
Eg: mail.google.com -
how to send an email from jsp page using java mail?like for submitting a form an email will be sent to the user email-id(the email-id is stored/match-ed in/from the database)???i m using tomcat 5.5 and netbeans 6.5.1...........so what should i do if dont want to use google smtp/pop3 port???
import java.io.*;
import java.net.InetAddress;
import java.util.Properties;
import java.util.Date;
import javax.mail.*;
import javax.mail.internet.*;
* Demo app that shows how to construct and send an RFC822
* (singlepart) message.
* XXX - allow more than one recipient on the command line
* @author Max Spivak
* @author Bill Shannon
public class msgsend {
public static void main(String[] argv) {
String to, subject = null, from = null,
cc = null, bcc = null, url = null;
String mailhost = null;
String mailer = "msgsend";
String file = null;
String protocol = null, host = null, user = null, password = null;
String record = null; // name of folder in which to record mail
boolean debug = false;
BufferedReader in =
new BufferedReader(new InputStreamReader(System.in));
int optind;
* Process command line arguments.
for (optind = 0; optind < argv.length; optind++) {
if (argv[optind].equals("-T")) {
protocol = argv[++optind];
} else if (argv[optind].equals("-H")) {
host = argv[++optind];
} else if (argv[optind].equals("-U")) {
user = argv[++optind];
} else if (argv[optind].equals("-P")) {
password = argv[++optind];
} else if (argv[optind].equals("-M")) {
mailhost = argv[++optind];
} else if (argv[optind].equals("-f")) {
record = argv[++optind];
} else if (argv[optind].equals("-a")) {
file = argv[++optind];
} else if (argv[optind].equals("-s")) {
subject = argv[++optind];
} else if (argv[optind].equals("-o")) { // originator
from = argv[++optind];
} else if (argv[optind].equals("-c")) {
cc = argv[++optind];
} else if (argv[optind].equals("-b")) {
bcc = argv[++optind];
} else if (argv[optind].equals("-L")) {
url = argv[++optind];
} else if (argv[optind].equals("-d")) {
debug = true;
} else if (argv[optind].equals("--")) {
optind++;
break;
} else if (argv[optind].startsWith("-")) {
System.out.println(
"Usage: msgsend [[-L store-url] | [-T prot] [-H host] [-U user] [-P passwd]]");
System.out.println(
"\t[-s subject] [-o from-address] [-c cc-addresses] [-b bcc-addresses]");
System.out.println(
"\t[-f record-mailbox] [-M transport-host] [-a attach-file] [-d] [address]");
System.exit(1);
} else {
break;
try {
* Prompt for To and Subject, if not specified.
if (optind < argv.length) {
// XXX - concatenate all remaining arguments
to = argv[optind];
System.out.println("To: " + to);
} else {
System.out.print("To: ");
System.out.flush();
to = in.readLine();
if (subject == null) {
System.out.print("Subject: ");
System.out.flush();
subject = in.readLine();
} else {
System.out.println("Subject: " + subject);
* Initialize the JavaMail Session.
Properties props = System.getProperties();
// XXX - could use Session.getTransport() and Transport.connect()
// XXX - assume we're using SMTP
if (mailhost != null)
props.put("mail.smtp.host", mailhost);
// Get a Session object
Session session = Session.getInstance(props, null);
if (debug)
session.setDebug(true);
* Construct the message and send it.
Message msg = new MimeMessage(session);
if (from != null)
msg.setFrom(new InternetAddress(from));
else
msg.setFrom();
msg.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(to, false));
if (cc != null)
msg.setRecipients(Message.RecipientType.CC,
InternetAddress.parse(cc, false));
if (bcc != null)
msg.setRecipients(Message.RecipientType.BCC,
InternetAddress.parse(bcc, false));
msg.setSubject(subject);
String text = collect(in);
if (file != null) {
// Attach the specified file.
// We need a multipart message to hold the attachment.
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(text);
MimeBodyPart mbp2 = new MimeBodyPart();
mbp2.attachFile(file);
MimeMultipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
mp.addBodyPart(mbp2);
msg.setContent(mp);
} else {
// If the desired charset is known, you can use
// setText(text, charset)
msg.setText(text);
msg.setHeader("X-Mailer", mailer);
msg.setSentDate(new Date());
// send the thing off
Transport.send(msg);
System.out.println("\nMail was sent successfully.");
* Save a copy of the message, if requested.
if (record != null) {
// Get a Store object
Store store = null;
if (url != null) {
URLName urln = new URLName(url);
store = session.getStore(urln);
store.connect();
} else {
if (protocol != null)
store = session.getStore(protocol);
else
store = session.getStore();
// Connect
if (host != null || user != null || password != null)
store.connect(host, user, password);
else
store.connect();
// Get record Folder. Create if it does not exist.
Folder folder = store.getFolder(record);
if (folder == null) {
System.err.println("Can't get record folder.");
System.exit(1);
if (!folder.exists())
folder.create(Folder.HOLDS_MESSAGES);
Message[] msgs = new Message[1];
msgs[0] = msg;
folder.appendMessages(msgs);
System.out.println("Mail was recorded successfully.");
} catch (Exception e) {
e.printStackTrace();
* Read the body of the message until EOF.
public static String collect(BufferedReader in) throws IOException {
String line;
StringBuffer sb = new StringBuffer();
while ((line = in.readLine()) != null) {
sb.append(line);
sb.append("\n");
return sb.toString();
}now what should i do???to call it from jsp??? -
Hi Jhe,
Hope You are Fine.
I tried to create a mail session using the j2eetutorial14 examples.I did all the necessary settings like giving the mailhost name,defining JNDI name etc as per specification.But its throwing the following error please help me to solve this problem.
Feb 15, 2007 12:28:16 PM com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: development3.s4indsoft.com; p
ort: 3700"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2257)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2278)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:208)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:221)
at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java
:104)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:
152)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:146)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:286)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:89)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:128)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:288)
at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:725)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:132)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:286)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at ConfirmerClient.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:237)
at com.sun.enterprise.appclient.Main.<init>(Main.java:430)
at com.sun.enterprise.appclient.Main.main(Main.java:99)
Caused by: java.lang.RuntimeException: java.nio.channels.UnresolvedAddressException
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:336)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:191)
... 22 more
Caused by: java.nio.channels.UnresolvedAddressException
at sun.nio.ch.Net.checkAddress(Net.java:30)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:451)
at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:320)
... 23 morehello, seems like a [url http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6404454]bug
-
Oracle Workflow Manager, Agent Listener, and Java Mailer problem
Hi,
I am not sure this topic to this forum, since this might be installation issue.
But I am hitting a big wall.
I had Windows 2000 SP4.
I have already installed Oracle Database 10gR1, Oracle Developer 10gR2, and Oracle Workflow 2.6.3 Standalone previously.
Including :
- Oracle Workflow Server 2.6.3
- Oracle Workflow Builder 2.6.3.5
- Apache HTTP Server 9.0.4
- Workflow Middle Tier
Anything seems to right, including the Notification Mailer and the Business Event.
And I had also made backup of them surely.
Now,
I'd like to change into Oracle Database 10gR2 because :
1. Some errors I found when I tried to call a Report from Oracle Form.
Unable to connect to Report Server ...
I thought Oracle Database 10gR1 is not suitable for Oracle Developer 10gR2.
2. And in the OWF 2.6.3 Workflow Home Page, there was no Logout button (which I found in OWF 2.6.4)
I removed my previous installation including Oracle Workflow.
After strugglineg in the installation of Oracle Database 10gR2, now I am facing another problem with Oracle Workflow.
I succesfully installed Oracle Workflow 2.6.4 Server and Oracle Workflow Manager (standalone version),
and the Oracle Workflow Middle Tier.
After I launch Oracle Workflow Configuration Assisstant, everthing seems to be normal.
I succed to open the Oracle Workflow Home Page (and found the Logout button there)
Next, I tried to navigate to the Oracle Workflow Manager.
1. I start the OC4J_Workflow_Management_Container --> initialized
2. OC4J_Workflow_Component_Container
The following error line appeared in the OC4J command prompt
06/05/26 10:31:40 LOG_ID_UNKNOWN : oracle.apps.fnd.cp.gsc.Logger.Logger(String,
int) : Logging to System.out until necessary parameters are retrieved for Logger
to be properly started.
06/05/26 10:31:40 LOG_ID_UNKNOWN : oracle.apps.fnd.cp.gsc.SvcComponentContainer.
initializeStateMachine() : BEGIN [default implementation]
06/05/26 10:31:40 LOG_ID_UNKNOWN : oracle.apps.fnd.cp.gsc.SvcComponentContainer.
getNewWorkflowContext() : BEGIN
06/05/26 10:31:45 LOG_ID_UNKNOWN : oracle.apps.fnd.cp.gsc.SvcComponentContainer.
loadGlobalParameters() : BEGIN
06/05/26 10:31:48 oracle.apps.fnd.wf.common.ContextFactoryException: Unable to g
et connection from data source because the following Exception occurred -> java.
sql.SQLException: ORA-28000: the account is locked
06/05/26 10:33:57 Oracle Application Server Containers for J2EE 10g (9.0.4.1.0)
initialized
3. finally it initialized
Next I tried to go to Oracle Workflow Manager from related link of Enterprise Manager
It is said that the OWF_MGR is locked
(I surprised since I had UNLOCKED the OWF_MGR after the installation and succeed to login at the Workflow Home Page)
And the following error line appeared in the commaned prompt after that
06/05/26 10:35:03 OrionCMTConnection not closed, check your code!
06/05/26 10:35:03 Logical connection not closed, check your code!
06/05/26 10:35:03 (Use -Djdbc.connection.debug=true to find out where the leaked
connection was created)
4. I re-UNLOCK the OWF_MGR and login to Oracle Workflow Manager
I noticed that the Agent Listener and Notification Service is Unavailable
(In OWF 2.6.3, The Agent Listener was started and Notification Service was waiting to be configured)
I tried to start one of the Agent Listener, but the following error appeared
ERROR: The Service Component Container is not running
Well, I had the same problem when installing the OWF 2.6.3
I tried to uninstall (remove) and re-install it like I had done before in OWF 2.6.3
(based on someone's post in Oracle's forum)
But this time, the re-installation won't fix this problem. (It was succeed in the OWF 2.6.3)
Everytime I start the OC4J, using wfmgrstart.bat and wfsvcstart.bat
the OWF_MGR is re-LOCKED(TIME) automatically.
And the servlet (WFALSNRSVC and WFMLRSVC) are not running.
I am worry, since I cannot use the Notification Mailer if this problem had not fixed yet.
(In OWF 2.6.3, the mailer was not available until those servlet is Started)
Sorry for the long post.
Any help would be grateful.
Many thanks,
BuntoroHi,
Finally, I have found the solution.
Step :
1. Start all of the Oracle Service, except for the OC4J
If you have already started OC4J, then stop them
Unlocked the <wf_manager_user>
2. Search in your Oracle Home : data-sources.xml
There should be two files,
one is in the ...\OC4J_Workflow_Component_Container\application-deployments\WFALSNRSVCApp
the other is in ...\OC4J_Workflow_Component_Container\application-deployments\WFMLRSVCApp
3. Make sure, you create back up of them.
4. Replace the following line
password="->pwForOwfMgr"
with
password="<your_wf_manager_password>",
should be look like this
password="a"
5. Now start the OC4J using wfmgrstart.bat and wfsvcstart.bat
6. Next, login to the Oracle Workflow Manager
This worked for me.
Hope this will help someone who has the same problem.
Buntoro -
Java Mail Problems within JSP Page
Hi all,
I'm encountering the following problem. I hava a jsp file named common.jsp with holds all common functions like write header and footer and also a send mail function. i include this page in all my other jsp pages. In the signup page - i need to send out 2 emails, one to the administrator and the other to the user who signed up. so i call that send mail function twice. the first call works(meaning it sends out the email) but the second call gives me a No SMTP Provider exception. Can anyone help me with this.
thx a bunch
p.s: i have included the sendEmail Function below
public void sendEmail(String emailServer, String sEmail, String sName, String rEmail,
String subject, String strmsg) throws Exception {
java.util.Properties props = new java.util.Properties();
props.put("mail.host", emailServer);
javax.mail.Session mailConn = javax.mail.Session.getInstance(props, null);
javax.mail.Message msg = new javax.mail.internet.MimeMessage(mailConn);
javax.mail.Address sender = new javax.mail.internet.InternetAddress(sEmail, sName);
javax.mail.Address receiver = new javax.mail.internet.InternetAddress(rEmail);
msg.setContent(strmsg,"text/html");
msg.setFrom(sender);
msg.setRecipient(javax.mail.Message.RecipientType.TO, receiver);
msg.setSubject(subject);
javax.mail.Transport.send(msg);
}This is what i use and it works just fine
import java.io.*;
import java.net.InetAddress;
import java.util.Properties;
import java.util.Date;
import javax.mail.*;
import javax.mail.internet.*;
public class sendMail {
public sendMail(String To,String Subject,String message) {
String to = To, subject = Subject, from = null,
cc = null, bcc = null, url = null;
String protocol = null, host = null, user = null, password = null;
boolean debug = false;
try{
Properties props = System.getProperties();
Session session = Session.getDefaultInstance(props, null);
Message msg = new MimeMessage(session);
if (debug)
session.setDebug(true);
msg.setFrom(new InternetAddress("[email protected]"));
msg.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(to, false));
msg.setSubject(subject);
msg.setText(message);
msg.setHeader("Mail","test.com");
msg.setSentDate(new Date());
Transport.send(msg);
System.out.println("\nMail was sent successfully.");
} catch (Exception e) {
e.printStackTrace(); -
Java Mail - problems receiving HTML mail from outlook
Hello,
I have a problem with receiving HTML mails from outlook. What I want to do is the following
- receiving a HTML mail - like a newsletter- send via Outlook
- display the mail via my mail client in a jtextpane
I tried it with the following code - but without success :
a)
Message msg = message; ByteArrayOutputStream os = new ByteArrayOutputStream();
message[i].getDataHandler().writeTo(os);
String data = new String(os.toByteArray());
textPane.setText(data);
b)
StringBuffer sb = null;
Multipart mp = (Multipart)message[i].getContent();
for (int j = 1; j < count; j++){
sb = new StringBuffer();
InputStream is = mp.getBodyPart(j).getInputStream();
int c;
while ((c = is.read()) != -1)
sb.append((char) c);
is.close();
textPane.setText(sb.toString());
Thanks,
MarioThis is what i use and it works just fine
import java.io.*;
import java.net.InetAddress;
import java.util.Properties;
import java.util.Date;
import javax.mail.*;
import javax.mail.internet.*;
public class sendMail {
public sendMail(String To,String Subject,String message) {
String to = To, subject = Subject, from = null,
cc = null, bcc = null, url = null;
String protocol = null, host = null, user = null, password = null;
boolean debug = false;
try{
Properties props = System.getProperties();
Session session = Session.getDefaultInstance(props, null);
Message msg = new MimeMessage(session);
if (debug)
session.setDebug(true);
msg.setFrom(new InternetAddress("[email protected]"));
msg.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(to, false));
msg.setSubject(subject);
msg.setText(message);
msg.setHeader("Mail","test.com");
msg.setSentDate(new Date());
Transport.send(msg);
System.out.println("\nMail was sent successfully.");
} catch (Exception e) {
e.printStackTrace(); -
Problem in using 'ReceivedDateTerm' in Java Mail
Hi there,
I have problem in using 'ReceivedDateTerm' in Java Mail. I am able to search on all other criterias but when I try any kind of date search I don't get any message back. For example I send an email and then I try to search that email using the following code I don't get any message back:
ReceivedDateTerm dateTerm = new ReceivedDateTerm(ComparisonTerm.EQ, new Date());
SearchTerm term = dateTerm;
// Other code
// Get messages
Message[] msgs = folder.search(term);
Please help???
Thanks & Regards,
Ajay SinghThe documentation for those classes is absolutely horrible. For example it doesn't say whether the time component of the Date is used, or ignored. It's possible you are asking to find all messages that were received at the exact millisecond you ran that code.
-
Problem in sending messages using java mail api
Hi All,
I have a problem in sending messages via java mail api.
MimeMessage message = new MimeMessage(session);
String bodyContent = "ñSunJava";
message.setText (bodyContent,"utf-8");using the above code its not possible for me to send the attachment. if i am using the below code means special characters like ñ gets removed or changed into some other characters.
MimeBodyPart messagePart = new MimeBodyPart();
messagePart.setText(bodyText);
// Set the email attachment file
MimeBodyPart attachmentPart = new MimeBodyPart();
FileDataSource fileDataSource = new FileDataSource("C:/sunjava.txt") {
public String getContentType() {
return "application/octet-stream";
attachmentPart.setDataHandler(new DataHandler(fileDataSource));
attachmentPart.setFileName(filename);
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messagePart);
multipart.addBodyPart(attachmentPart);
message.setContent(multipart);
Transport.send(message);is there any way to send the file attachment with the body message without using MultiPart java class.Taken pretty much straight out of the Javamail examples the following works for me (mail read using Thunderbird) // Define message
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
// Set the 'to' address
for (int i = 0; i < to.length; i++)
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
// Set the 'cc' address
for (int i = 0; i < cc.length; i++)
message.addRecipient(Message.RecipientType.CC, new InternetAddress(cc[i]));
// Set the 'bcc' address
for (int i = 0; i < bcc.length; i++)
message.addRecipient(Message.RecipientType.BCC, new InternetAddress(bcc[i]));
message.setSubject("JavaMail With Attachment");
// Create the message part
BodyPart messageBodyPart = new MimeBodyPart();
// Fill the message
messageBodyPart.setText("Here's the file ñSunJava");
// Create a Multipart
Multipart multipart = new MimeMultipart();
// Add part one
multipart.addBodyPart(messageBodyPart);
// Part two is attachment
for (int count = 0; count < 5; count++)
String filename = "hello" + count + ".txt";
String fileContent = " ñSunJava - Now is the time for all good men to come to the aid of the party " + count + " \n";
// Create another body part
BodyPart attachementBodyPart = new MimeBodyPart();
// Get the attachment
DataSource source = new StringDataSource(fileContent, filename);
// Set the data handler to this attachment
attachementBodyPart.setDataHandler(new DataHandler(source));
// Set the filename
attachementBodyPart.setFileName(filename);
// Add this part
multipart.addBodyPart(attachementBodyPart);
// Put parts in message
message.setContent(multipart);
// Send the message
Transport.send(message); -
Problem in retrieving email using java mail api
hi,
In my project,i am retrieving mails from a particular email id.
I am able to retrieve the latest mails and save it in a folder in my system.
The problem is whenever i run the program eventhough the most recently received mail in inbox is retrieved and saved,again it is retrieving the same one and saving it in the same folder(not repeating).
I tried to check the newmessages in the inbox using the folder.hasNewMessage() method in java mail api,but the method is returning false only regardless new mail is there in inbox or not.
I want to read the unread messages only.Dont want to retrieve the already read mails.
I got the mail retrieving code from the below site.(sorry not posting the code because it is so long and having 4 classes)
http://www.builderau.com.au/program/java/soa/Getting_the_mail_in_receiving_in_JavaMail/0,39024620,39228060,00.htm
Can anyone tell me how to read unread mails in the inbox?
Thanks a lothi parvathi
i think your mail program is receving mails using imap
the imap is only receve the mail from server but the pop is deleting the mails after receving
use the following sample code
package com.sfrc.mail.pop;
import javax.mail.*;
import javax.mail.internet.*;
import com.sun.mail.handlers.message_rfc822;
import java.util.*;
import java.io.*;
* Owner: SFRC IT Solutions Pvt Ltd
* Author:Arunkumar Subramaniam
* Date :12-06-2006
* File Name: AttachRecive.java
public class AttachRecive
public static void main(String args[])
try
String popServer="192.168.1.1";
String popUser="pl";
String popPassword="password";
// Create empty properties
Properties props = new Properties();
// Get session
Session session = Session.getDefaultInstance(props, null);
// Get the store
Store store = session.getStore("pop3");
store.connect(popServer, popUser, popPassword);
// Get folder
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_ONLY);
// Get directory
Message message =folder.getMessages();
Multipart mp = (Multipart)message.getContent();
for (int i=0, n=mp.getCount(); i<n; i++) {
Part part = mp.getBodyPart(i);
String disposition = part.getDisposition();
// Close connection
folder.close(false);
store.close();
catch (Exception ex)
System.out.println("Usage: "
+" popServer popUser popPassword");
System.exit(0);
Regards
Arunkumar Subramaniam
SFRC IT Solutions Pvt Ltd
Chennai -
Java Session problem while sending mail(using javamail) using Pl/SQL
Hello ...
i am using Java stored procedure to send mail. but i'm getting java session problem. means only once i can execute that procedure
pls any help.props.put("smtp.gmail.com",host);I doubt javamail recognizes the 'smtp.gmail.com' property. I think it expects 'mail.host'. Of course since it cannot find a specified howt it assumes by default localhost
Please format your code when you post the next time, there is a nice 'code' button above the post area.
Mike -
Problem using Java Mail API with WLS 7.0
Hi All,
I am trying to use the Java Mail API provided by WLS 7.0. I have made the
settings metioned in the WLS 7.0 docs. However when I try to run the program I
am getting the following error:
javax.naming.NoInitialContextException: Need to specify class name in environment
or system property, or as an applet parameter, or in an application resource file:
java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
46)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
a:283)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
The code that I have written is as follows
import java.util.*;
import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.naming.*;
import java.io.*;
import java.net.InetAddress;
import java.util.Properties;
import java.util.Date;
public class MailTo {
public static void main(String args[])
try
//Context ic = getInitialContext();
InitialContext ic = new InitialContext();
/* My jndi name is "testSession" */
Session session = (Session) ic.lookup("testSession"); /* THE PROBLEM IS SHOWN
IN THIS LINE */
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", "XX.XX.XX.XX");
/* For security reasons I have written the ip add in this format */
props.put("mail.from", "[email protected]"); /* for security reasons i have
changed the mail address */
Session session2 = session.getInstance(props);
Message msg = new MimeMessage(session2);
msg.setFrom();
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("[email protected]",
false));
msg.setSubject("Test Message");
msg.setSentDate(new Date());
MimeBodyPart mbp = new MimeBodyPart();
mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp);
msg.setContent(mp);
Transport.send(msg);
catch(Exception e)
e.printStackTrace();
}//end of main
public static Context getInitialContext()
throws NamingException
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL, "t3://localhost:7501/testWebApp");
p.put(Context.SECURITY_PRINCIPAL, "weblogic");
p.put(Context.SECURITY_CREDENTIALS, "weblogic");
return new InitialContext(p);
}//end of class
Can anyone please tell me what is the problem. I thought that we cannot directly
do
InitialContext ic = new InitialContext();
So I had written a method getInitialContext() as shown in the above piece of code,
but that too did not work.
Eagerly awaiting a response.
Jimmy ShahYou can use InitialContext ic = new InitialContext() only if you are using a startup class, servlet or a JSP i.e
server side code.
If you are using a java client you need to use Context ic = getInitialContext();
Try this code
import java.util.*;
import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.naming.*;
import java.io.*;
import java.net.InetAddress;
import java.util.Properties;
import java.util.Date;
public class MailTo {
public static void main(String args[])
try {
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, "t3://localhost:7001");
Context ic = new InitialContext(h);
Session session = (Session) ic.lookup("testSession");
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", "XX.XX.XX.XX");
props.put("mail.from", "[email protected]");
Session session2 = session.getInstance(props);
Message msg = new MimeMessage(session2);
msg.setFrom();
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse("[email protected]",false));
msg.setSubject("Test Message");
msg.setSentDate(new Date());
MimeBodyPart mbp = new MimeBodyPart();
mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp);
msg.setContent(mp);
Transport.send(msg);
catch(Exception e)
e.printStackTrace();
}//end of main
}//end of class
We have shipped a javamail example in the samples\server\src\examples\javamail folder.
Jimmy Shah wrote:
Hi All,
I am trying to use the Java Mail API provided by WLS 7.0. I have made the
settings metioned in the WLS 7.0 docs. However when I try to run the program I
am getting the following error:
javax.naming.NoInitialContextException: Need to specify class name in environment
or system property, or as an applet parameter, or in an application resource file:
java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
46)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
a:283)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
The code that I have written is as follows
import java.util.*;
import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.naming.*;
import java.io.*;
import java.net.InetAddress;
import java.util.Properties;
import java.util.Date;
public class MailTo {
public static void main(String args[])
try
//Context ic = getInitialContext();
InitialContext ic = new InitialContext();
/* My jndi name is "testSession" */
Session session = (Session) ic.lookup("testSession"); /* THE PROBLEM IS SHOWN
IN THIS LINE */
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", "XX.XX.XX.XX");
/* For security reasons I have written the ip add in this format */
props.put("mail.from", "[email protected]"); /* for security reasons i have
changed the mail address */
Session session2 = session.getInstance(props);
Message msg = new MimeMessage(session2);
msg.setFrom();
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("[email protected]",
false));
msg.setSubject("Test Message");
msg.setSentDate(new Date());
MimeBodyPart mbp = new MimeBodyPart();
mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp);
msg.setContent(mp);
Transport.send(msg);
catch(Exception e)
e.printStackTrace();
}//end of main
public static Context getInitialContext()
throws NamingException
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL, "t3://localhost:7501/testWebApp");
p.put(Context.SECURITY_PRINCIPAL, "weblogic");
p.put(Context.SECURITY_CREDENTIALS, "weblogic");
return new InitialContext(p);
}//end of class
Can anyone please tell me what is the problem. I thought that we cannot directly
do
InitialContext ic = new InitialContext();
So I had written a method getInitialContext() as shown in the above piece of code,
but that too did not work.
Eagerly awaiting a response.
Jimmy Shah--
Rajesh Mirchandani
Developer Relations Engineer
BEA Support -
Problem with sending mail throgh java mail api
hi folks,
We are having problem regarding sending mail using java mail api.
we are using msgsendsample.java file from demo folder contained in javamail-1.3.3_01 folder.
we are using following command at dos prompt.:
java msgsendsample [email protected] [email protected] smtp.mail.yahoo.com false
It gives following Exception:
--Exception handling in msgsendsample.java
com.sun.mail.smtp.SMTPSendFailedException: 530 authentication required - for hel
p go to http://help.yahoo.com/help/us/mail/pop/pop-11.html
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1
333) at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:906)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:535)
at javax.mail.Transport.send0(Transport.java:151)
at javax.mail.Transport.send(Transport.java:80)
at msgsendsample.main(msgsendsample.java:93)
** ValidUnsent Addresses
[email protected]
Thanking in Advance...
Please give us guidance to any alternate solution if exists.hi
the smtp server u are using should allow u to send mail to other smtp server like if u r sending mail to yahoo account u have to use yahoo smtp server only .....
bye -
Problems while sending mail using java mail..help...
Hello all,
I am new to Java Mail...
Below is my first program...
Can anybody tell what's wrong in it..??
Thanks in advance....
------------------------------------------------------start--------------------
package test;
import java.util.Properties;
import javax.mail.Address;
import javax.mail.Authenticator;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.Message.RecipientType;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class Send
public Send()
public void send()
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
Properties props=new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host","smtp.gmail.com");
props.put("mail.smtp.port","25");
props.put("mail.smtp.auth","true");
Session session=Session.getDefaultInstance(props,new MyAuthenticator());
session.setDebug(true);
MimeMessage message=new MimeMessage(session);
try
message.setContent("Hello ...","text/plain");
message.setSubject("Test mail...plz don't ignore..");
Address to=new InternetAddress("[email protected]");
Address from=new InternetAddress("[email protected]");
Address replyTo=new InternetAddress("[email protected]");
message.setFrom(from);
message.setReplyTo(new Address[]{replyTo});
message.setRecipient(RecipientType.TO,to);
Transport.send(message);
} catch (AddressException e)
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchProviderException e)
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MessagingException e)
// TODO Auto-generated catch block
e.printStackTrace();
public static void main(String[] args)
new Send().send();
class MyAuthenticator extends Authenticator
MyAuthenticator()
super();
protected PasswordAuthentication getPasswordAuthentication()
return new PasswordAuthentication("[email protected]", "*******");
--------------------------------------------end--------------
here is the output.....
DEBUG: setDebug: JavaMail version 1.3.2
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 25, isSSL false
220 mx.gmail.com ESMTP 16sm2443823wrl
DEBUG SMTP: connected to host "smtp.gmail.com", port: 25
EHLO jijo
250-mx.gmail.com at your service
250-SIZE 20971520
250-8BITMIME
250-STARTTLS
250 ENHANCEDSTATUSCODES
DEBUG SMTP: Found extension "SIZE", arg "20971520"
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "STARTTLS", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<[email protected]>
530 5.7.0 Must issue a STARTTLS command first
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1275)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:895)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:524)
at javax.mail.Transport.send0(Transport.java:151)
at javax.mail.Transport.send(Transport.java:80)
at test.Send.send(Send.java:50)
at test.Send.main(Send.java:68)
QUIT
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1275)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:895)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:524)
at javax.mail.Transport.send0(Transport.java:151)
at javax.mail.Transport.send(Transport.java:80)
at test.Send.send(Send.java:50)
at test.Send.main(Send.java:68)
Can any body help me..??
Thanks and Regards
Jijo vincentHi All,
I am new to javax.mail.
I have attached my code and also error here...
can anyone help to resolve the error?
Code:
public class MailExample {
public static void main(String args[]) {
try {
String host = "localhost"; //args[0];
String from = "[email protected]"; //args[1];
// String to = "[email protected]";//args[2];
String to = "[email protected]";//args[2];
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
props.put("mail.smtp.starttls.enable","true");
//props.put("mail.smtp.auth","true");
// Get session
Session session = Session.getDefaultInstance(props, null);
session.setDebug(true);
// Define message
MimeMessage message = new MimeMessage(session);
// Set the from address
message.setFrom(new InternetAddress(from));
// Set the to address
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
// Set the subject
message.setSubject("Hello JavaMail");
// Set the content
message.setText("Welcome to JavaMail");
// Send message
Transport.send(message);
catch(AddressException ae){
ae.printStackTrace();
}catch (MessagingException e)
// TODO Auto-generated catch block
e.printStackTrace();
Error:
DEBUG: setDebug: JavaMail version 1.3.3ea
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "localhost", port 25, isSSL false
220 localhost
DEBUG SMTP: connected to host "localhost", port: 25
EHLO HDCHCTDAM33726
250-localhost
250 HELP
DEBUG SMTP: Found extension "HELP", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<[email protected]>
250 [email protected] Address Okay
RCPT TO:<[email protected]>
250 [email protected] Address Okay
DEBUG SMTP: Verified Addresses
DEBUG SMTP: [email protected]
DATA
354 Start mail input; end with <CRLF>.<CRLF>
Message-ID: <10736847.01125315340863.JavaMail.sangeetham@HDCHCTDAM33726>
From: [email protected]
To: [email protected]
Subject: Hello JavaMail
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Welcome to JavaMail
com.sun.mail.smtp.SMTPSendFailedException: 550 Invalid recipient: [email protected]
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1333)
at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:1160)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:538)
at javax.mail.Transport.send0(Transport.java:151)
at javax.mail.Transport.send(Transport.java:80)
at org.worldbank.webmfr.util.MailExample.main(MailExample.java:55)550 Invalid recipient: [email protected]
com.sun.mail.smtp.SMTPSendFailedException: 550 Invalid recipient: [email protected]
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1333)
at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:1160)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:538)
at javax.mail.Transport.send0(Transport.java:151)
at javax.mail.Transport.send(Transport.java:80)
at org.worldbank.webmfr.util.MailExample.main(MailExample.java:55)
QUIT -
hi,
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> Java Mail </title>
</head>
<body>
<form action="newjsp.jsp" method="POST">
<table border="0" align="center" cellpadding="5">
<tbody>
<tr> <td colspan="3" align="center">
<b> Send Mail </b> </td> </tr>
<tr>
<td> To </td> <td> : </td>
<td> <input type="text" name="to" value="" /> </td>
</tr>
<tr>
<td> Subject </td> <td> : </td>
<td> <input type="text" name="subject" value="" /> </td>
</tr>
<tr>
<td> Message </td> <td> : </td>
<td> <textarea name="message" rows="8" cols="30">
</textarea></td>
</tr>
<tr>
<td colspan="3" align="center">
<input type="submit" value="Send Mail" />
<input type="reset" value="Reset" />
<td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
* To change this template, choose Tools | Templates
* and open the template in the editor.
package abc;
* @author bgoyal
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class Mail {
private String to;
private String from;
private String message;
private String subject;
private String smtpServ;
* @return the to
public String getTo() {
return to;
* @param to the to to set
public void setTo(String to) {
this.to = to;
* @return the from
public String getFrom() {
return from;
* @param from the from to set
public void setFrom(String from) {
this.from = from;
* @return the message
public String getMessage() {
return message;
* @param message the message to set
public void setMessage(String message) {
this.message = message;
* @return the subject
public String getSubject() {
return subject;
* @param subject the subject to set
public void setSubject(String subject) {
this.subject = subject;
* @return the smtpServ
public String getSmtpServ() {
return smtpServ;
* @param smtpServ the smtpServ to set
public void setSmtpServ(String smtpServ) {
this.smtpServ = smtpServ;
public int sendMail(){
try
Properties props = System.getProperties();
// -- Attaching to default Session, or we could start a new one --
props.put("mail.transport.protocol", "smtp" );
props.put("mail.smtp.starttls.enable","true" );
props.put("mail.smtp.host",smtpServ);
props.put("mail.smtp.auth", "true" );
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getInstance(props, auth);
// -- Create a new message --
Message msg = new MimeMessage(session);
// -- Set the FROM and TO fields --
msg.setFrom(new InternetAddress(from));
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
msg.setSubject(subject);
msg.setText(message);
// -- Set some other header information --
msg.setHeader("MyMail", "Mr. XYZ" );
msg.setSentDate(new Date());
// -- Send the message --
Transport.send(msg);
System.out.println("Message sent to"+to+" OK." );
return 0;
catch (Exception ex)
ex.printStackTrace();
System.out.println("Exception "+ex);
return -1;
// Also include an inner class that is used for authentication purposes
private class SMTPAuthenticator extends javax.mail.Authenticator {
@Override
public PasswordAuthentication getPasswordAuthentication() {
String username = "[email protected]"; // specify your email id here (sender's email id)
String password = "javamail"; // specify your password here
return new PasswordAuthentication(username, password);
}error is
type Status report
message
descriptionThe requested resource () is not available.
<%--
Document : sendMail.jsp
Created on : Aug 11, 2009, 1:50:50 PM
Author : bgoyal
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
<jsp:useBean id="mail" scope="session" class="abc.Mail" />
<jsp:setProperty name="mail" property="to" param="to" />
<jsp:setProperty name="mail" property="from" value="[email protected]" />
<jsp:setProperty name="mail" property="smtpServ" value="smtp.gmail.com" />
<jsp:setProperty name="mail" property="subject" param="subject" />
<jsp:setProperty name="mail" property="message" param="message" />
<%
String to = mail.getTo();
int result;
result = mail.sendMail();
if(result == 0){
out.println(" Mail Successfully Sent to "+to);
else{
out.println(" Mail NOT Sent to "+to);
%>
</body>
</html>And?
Maybe you are looking for
-
Move Mail Rules: Snow Leopard to Mountain Lion
I copied the following files from my SL (MacBookPro) to my new ML (MacBookAir): user/Library/Mail/MessageRules.plist user/Library/Mail/MessageRules.plist.backup copied into this directory on the new machine: user/Library/Mail/V2/MailData/ Not sure wh
-
Replacing audio in QT movie doesn't change overall size of movie?
H-264 movie made for web distribution. My best video compressor only creates AIF audio files ... which are mighty big. I made an MP3 audio file in Logic. I replaced the original AIF audio in the Quicktime movie with the MP3 audio ... (which is 23 meg
-
Java ME SDK 3.0 server certificates problem
Hi, I'm having a problem using HTTPS connection with the Java ME 3.0 emulator. We have a server certificate from Thawte, but I get javax.microedition.pki.CertificateException: Certificate was issued by an unrecognized entitywhen I try connecting to o
-
Can you make your Moblie Me Account say you are somewhere where you are not? Can you tell it where you want it to say you are? Thanks
-
3rd party LDAP JAZN configuration
Hey, I've been struggling with the jazn configuration of a 3rd party LDAP (Sun One) server. I've followed the Oracle 10AS documentation on creating the <jazn-loginconfig> element and there is an example template for sun one in the Oracle 10 AS. What