geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From metamor <mbarri...@kickapps.com>
Subject Re: Cannot send email using geronimo default email session
Date Tue, 22 Jul 2008 16:32:26 GMT

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("metamor@foo.com"));
message.addRecipient(Message.RecipientType.TO, new
InternetAddress("metamor@gmail.com"));
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!

-- 
View this message in context: http://www.nabble.com/Cannot-send-email-using-geronimo-default-email-session-tp18577933s134p18593404.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Mime
View raw message