Does your server require an SSL connection? The transport has connected ok, but has not received a response back from the server for the initial welcome reply. This sort of points in the direction of perhaps needed to use the "smtps" protocol rather than "smtp".

Rick


metamor wrote:
Thank you very much, your solution fixed my problem. Now I have another issue, I am trying to connect to our smtp with
authentication, this is the code that I am using:

InitialContext context = new InitialContext();
// Mail session from web.xml's resource reference
Session mailSession = (Session)
context.lookup("java:comp/env/mail/kickappsMailSession");
mailSession.getProperties().put("mail.smtp.auth", "true");

Transport transport = mailSession.getTransport("smtp");
transport.connect("mail.foo.com", "norepl12", "1norep21");

MimeMessage message = new MimeMessage(mailSession);
message.setFrom(new InternetAddress("[EMAIL PROTECTED]"));
message.addRecipient(Message.RecipientType.TO, new
InternetAddress("[EMAIL PROTECTED]"));
message.setSubject("test");
message.setText("test");
message.saveChanges();
transport.send(message);

In the Transport.connect() I am getting the following error:

javax.mail.MessagingException: java.net.SocketTimeoutException: Read timed
out
        at
org.apache.geronimo.javamail.transport.smtp.SMTPTransport.receiveLine(SMTPTransport.java:1796)
        at
org.apache.geronimo.javamail.transport.smtp.SMTPTransport.receiveLine(SMTPTransport.java:1716)
        at
org.apache.geronimo.javamail.transport.smtp.SMTPTransport.getReply(SMTPTransport.java:1726)
        at
org.apache.geronimo.javamail.transport.smtp.SMTPTransport.getWelcome(SMTPTransport.java:1385)
        at
org.apache.geronimo.javamail.transport.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:389)
        at javax.mail.Service.connect(Service.java:271)
        at javax.mail.Service.connect(Service.java:91)

Any ideas of what is wrong now? Thanks so much for your help!


Reply via email to