on 02-16-2008 7:57 AM
*hi all,*
*i need to send mail using webdynpro java*
*i have used folloeing code*
String recepient ="myEmail_ID";
StringBuffer strMailBody;
String strSMTPIPAddress ="Myhostname";
Properties props;
Session session;
Provider p;
props = System.getProperties();
props.put("mail.smtp.host", strSMTPIPAddress);
session = Session.getDefaultInstance(props, null);
p = session.getProvider("smtp");
strMailBody = new StringBuffer();
strMailBody.append("My Messgae Body ...");
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("Email_Id"));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(recepient));
message.setSubject("Employee Resignation Request");
message.setText(strMailBody.toString());
Transport.send(message);
*but i am getting following runtime error...*
javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25; nested exception is: java.net.ConnectException: Connection refused: connect
So what should i need to change....to get the code working...
Hi Piyush,
Its appears that you haven't a service running a localhost port 25.
To certify about it, try to connect on localhost port 25 using telnet;
ie.: c:\telnet localhost 25
If it fail too, try to find the correct host and port that your SMTP is running.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
https://forums.sdn.sap.com/click.jspa?searchID=8907099&messageID=4477062
http://www.jguru.com/faq/view.jsp?EID=12854
/thread/590866 [original link is broken]
http://www.mail-archive.com/user@geronimo.apache.org/msg05845.html
http://www.mail-archive.com/user@geronimo.apache.org/msg05861.html
xxxxxxxxxxxxxxxxxxxxxxx
Edited by: Armin Reichert on Feb 18, 2008 7:12 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.