on 02-18-2015 12:53 PM
Hi,
In a webdynpro application, the email is sent to the user on submitting the request using the below code.
IUMParameters er = UMFactory.getProperties();
String host = er.get("ume.notification.mail_host");
/*get the system properties*/
Properties props = System.getProperties();
/*set up mail server*/
props.put("mail.smtp.host", host);
/*get session*/
Session session1 = Session.getInstance(props);
/*define message*/
MimeMessage message = new MimeMessage(session1);
if((null!=fromId && !fromId.equals("")) && (null!=subject &&!subject.equals(""))&&(null!=text && !text.equals("")))
{
message.setFrom(new InternetAddress(fromId));
for (int i = 0; i < toIds.length; i++) {
if (null!= toIds[i] && !toIds[i].equals(""))
message.addRecipient(MimeMessage.RecipientType.TO,new InternetAddress(toIds[i]));
}
message.setSubject(subject);
message.setText(text, "utf-8");
javax.mail.Transport.send(message);
The SMTP server details were recently for the email sending. After changing the details an exception is thrown as below.
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
Kindly help on why this error is appearing.
Regards,
Bhaskar
If i were you, i would first check my code is working or not by my gmail account information. When i sure that the code is working fine then i ask my system admin to give me the information of my company smtp information. As far as i see that the error appear because of your smpt information is not right.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
localhost is your smtp server?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Reply - NWA - Identity management – configuration – Notification emails - Host Name of the SMTP Server: - empty before and after the change.
Reply - has the entry “localhost” in visual admin (Java mail client – smtp mapping). This is the default value.
We tried changing this entry to point to new SMTP server and restarting the service but the error remained unchanged.
Localhost points to 127.0.0.1 in our /etc/hosts file
Old SMTP server is oldserver.org
And new SMTP server is newserver.org
this is the proper way to send mail in sap java server
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.