Unknown smtp host
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mujtaba_Ahmed
Posted On:   Sunday, October 6, 2002 01:39 PM

Hi! I have tried an example code "TestMail.jsp" which simply sends an email, but it's not working. Following is the code: <%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %> <% Properties props = new Properties(); props.put("mail.smtp.host", "smtp.mail.hotmail.com");//what should come here Session s = Session.getInstance(props,null); MimeMessage message = new MimeMessage(s); InternetAddress from = new InternetAddress("universe_ahmed@yahoo.com"); message.setFrom(from); InternetAddress to = new InternetAddress("cool_sal78@hotmail.com"); message.addR   More>>

Hi!



I have tried an example code "TestMail.jsp"
which simply sends an email, but it's
not working. Following is the code:



			
<%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %>
<%
Properties props = new Properties();
props.put("mail.smtp.host", "smtp.mail.hotmail.com");//what should come here
Session s = Session.getInstance(props,null);

MimeMessage message = new MimeMessage(s);

InternetAddress from = new InternetAddress("universe_ahmed@yahoo.com");
message.setFrom(from);
InternetAddress to = new InternetAddress("cool_sal78@hotmail.com");
message.addRecipient(Message.RecipientType.TO, to);

message.setSubject("Test from JavaMail.");
message.setText("Hello from JavaMail!");

Transport.send(message);
%>


Following is the error it's showing:



			
Internal Servlet Error:

javax.servlet.ServletException: Sending failed;
nested exception is:
class javax.mail.MessagingException: Unknown SMTP host: smtp.mail.hotmail.com;
nested exception is:
java.net.UnknownHostException: smtp.mail.hotmail.com

Thanks!    <<Less

Re: Unknown smtp host

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, October 7, 2002 08:18 AM

props.put("mail.smtp.host", "smtp.mail.hotmail.com");//what should come here



You should put the hostname of your local SMTP server, the one which has been configured to accept your outgoing email for you, from the return addresses you are using, and from the hosts you are using.

About | Sitemap | Contact