on 05-10-2007 1:02 PM
Hi All,
I am developing a Contact Us form. The application is giving me the foll. exception
javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Unknown SMTP host: mail.exchange.com; nested exception is: java.net.UnknownHostException: mail.exchange.com
My code is as follows:
Properties properties = new Properties();
String SMTPIPAddress = "smtpipaddress";
String SMTPAddress = "smtpaddress";
String mailId = "mymailid@domain.com";
Session session;
Provider p;
properties = System.getProperties();
properties.put("SMTPAddress ", "SMTPIPAddress");
session = Session.getDefaultInstance(properties, null);
Message message = new MimeMessage(session);
try{
message.setFrom(new InternetAddress(mailId));
message.addRecipient(Message.RecipientType.TO,
new InternetAddress(mailId));
message.setSubject("Conference");
message.setText("Hello");
Transport.send(message);
}catch (AddressException ade) {
wdComponentAPI.getMessageManager().raiseException(ade.toString(),false);
}catch(MessagingException msge){
wdComponentAPI.getMessageManager().raiseException("MessagingException "+msge.toString(),true);
}catch(Exception e){
wdComponentAPI.getMessageManager().raiseException("Exception "+e.toString(),true);
}
Please let me know what is wrong.
Regards
Nikhil Bansal
Hi Nikhil
Check for ur SMTP ip address..
Regards
khushboo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nikhil,
I think you are missing the following in your shared Reference.Pl add this and give a try:
<property name="PrivateSharingReference" value="SAPJ2EE::library:mail"/>
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nikhil,
Code seems to be good.
Please check wheather port for the same is opened or not.
Usaully Port has to be configured to send a mail.
regards
Anil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhijeet,
Thanks for the reply.
I have given the IP address of SMTP address in Java Mail Client in Visual Admin.
However, I am getting the foll. exception
MessagingException 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
Has it got something to do with the port being opened for SMTP host.
Please let me know.
Regards
Nikhil
Hi,
I am also getting the same error:
javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Could not connect to SMTP host: 10.236.133.250, port: 25; nested exception is: java.net.ConnectException: Connection refused: connect
I configured in VA-> JAVA MAIL->SMTP as the SMTP IP
I am also able to ping thru' telnet.
Where do I need to configure port ?
Regards,
Poonam
Nikhil,
Code seems to be good.
Please check wheather port for the same is opened or not.
Usaully Port has to be configured to send a mail.
regards
Anil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.