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 Wed, 23 Jul 2008 16:04:13 GMT


I tried using the sun smtp implementation and works.
With Geronimo I have turned on debug and I get the following error:

SMTPTransport DEBUG: Connecting to server mail.foo.com:-1 for user noreply
SMTPTransport DEBUG: Attempting plain socket connection to server
mail.foo.com:25
220 *******************************
EHLO DEV-ITLAP-017
250-mail.foo.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN CRAM-MD5 DIGEST-MD5
250 8BITMIME
DEBUG: getProvider() returning provider protocol=smtp;
type=javax.mail.Provider$Type@34ca4e;
class=org.apache.geronimo.javamail.transport.smtp.SMTPTransport;
vendor=Apache Software Foundation;version=1.0
SMTPTransport DEBUG: Connecting to server localhost:-1 for user metamor
SMTPTransport DEBUG: Attempting plain socket connection to server
localhost:25

So on transport.connect() it tries to connect to mail.foo.com (as it should)
but for transport.send() it tries localhost?

The code that I am using is very simple:

InitialContext context = new InitialContext();
Session mailSession = (Session)
context.lookup("java:comp/env/mail/testMailSession");
mailSession.setDebug(true);

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

MimeMessage message = new MimeMessage(mailSession);
message.setFrom(new InternetAddress("metamor@yahoo.com"));
message.addRecipient(Message.RecipientType.TO, new
InternetAddress("metamor@gmail.com"));
message.setSubject("test");
message.setText("test");
message.saveChanges();

transport.send(message);

Do you know what is wrong?
Thanks in advance!

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


Mime
View raw message