Unknown SMTP host
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Markandeya_T
Posted On:   Tuesday, December 17, 2002 05:27 AM

I am using Tomcat. I got the follwing exception: ENCOUNTERED EXCEPTION: javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Unknown SMTP host: com.sun.mail.smtp.SMTPTransport; nested exception is: java.net.UnknownHostException: com.sun.mail.smtp.SMTPTransport javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Unknown SMTP host: com.sun.mail.smtp.SMTPTransport; My Code is <%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %> <% Properties props = System.getProperties(); props.put("mail.transport.protocol","smtp");    More>>

I am using Tomcat. I got the follwing exception:


ENCOUNTERED EXCEPTION: javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Unknown SMTP host: com.sun.mail.smtp.SMTPTransport; nested exception is: java.net.UnknownHostException: com.sun.mail.smtp.SMTPTransport
javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: Unknown SMTP host: com.sun.mail.smtp.SMTPTransport;


My Code is


<%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %>
<%
Properties props = System.getProperties();
props.put("mail.transport.protocol","smtp");
props.put("mail.smtp.host", "com.sun.mail.smtp.SMTPTransport");


Session s = Session.getInstance(props,null);

MimeMessage message = new MimeMessage(s);

InternetAddress from = new InternetAddress("mark@ganpatiss.com");
message.setFrom(from);
InternetAddress to = new InternetAddress("srijm@hotmail.com");
message.addRecipient(Message.RecipientType.TO, to);

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

Transport.send(message);
%>


Pl Help..
Mark

   <<Less

Re: Unknown SMTP host

Posted By:   Jason_Bailey  
Posted On:   Tuesday, December 17, 2002 06:34 PM

To further elaborate, in the part of your code where you wrote this:



props.put("mail.smtp.host","com.sun.mail.smtp.SMTPTransport");



"com.sun.mail.smtp.SMTPTransport" is not what you should have written. What java is looking for here is a host on your network that has an SMTP server running on it.



If your not sure what that is you should probably contact your local network guru or your ISP.

Re: Unknown SMTP host

Posted By:   Christopher_Koenigsberg  
Posted On:   Tuesday, December 17, 2002 07:51 AM

You need to give it a valid SMTP host.

About | Sitemap | Contact