dcsimg
Another Javamail question...
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   DJ_Porter
Posted On:   Wednesday, November 6, 2002 05:35 AM

Hi, My hosting company (running tomcat, with the Javamail API in the classpath, which is there) have informed me that the transport properties for the mail are 127.0.0.1 and port 25. Bearing in mind that port 25 is the default, I have tried the following code: <%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %> <% Properties props = new Properties(); props.put("mail.smtp.host", "127.0.0.1"); Session s = Session.getInstance(props,null); MimeMessage message = new MimeMessage(s); InternetAddress from = new InternetAddress("blah@blah.co.uk"); message.setFrom(from); InternetAdd   More>>

Hi,


My hosting company (running tomcat, with the Javamail API in the classpath, which is there) have informed me that the transport properties for the mail are 127.0.0.1 and port 25. Bearing in mind that port 25 is the default, I have tried the following code:


			
<%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %>
<%
Properties props = new Properties();
props.put("mail.smtp.host", "127.0.0.1");
Session s = Session.getInstance(props,null);

MimeMessage message = new MimeMessage(s);

InternetAddress from = new InternetAddress("blah@blah.co.uk");
message.setFrom(from);
InternetAddress to = new InternetAddress("blah@blah.com");
message.addRecipient(Message.RecipientType.TO, to);

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

Transport.send(message);
%>

A Message has been sent.
Check your inbox.


Click here to send another!





Locally this works with my mailserver, but when I change the mailserver to the ip and upload the file, I don't get anything, it keeps trying to load the page, and does not even give a mailserver not found exception (it does if I change this to smtp.blah..). I have also tried using the transport object to specify the port aswell, but with no luck.


Has anybody got an idea what is going wrong?


Thanks,


DJ.

   <<Less
About | Sitemap | Contact