aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes JavaMail works on one server, but not another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JavaMail works on one server, but not another" Watch "JavaMail works on one server, but not another" New topic
Author

JavaMail works on one server, but not another

Jennifer Bhamoo
Ranch Hand

Joined: Mar 09, 2002
Posts: 47
Hello,

I don't even know where to begin to try and troubleshoot this.

I am using JavaMail 1.4 to send an email and it works on my laptop, but when I deploy to my server, no email gets sent. (Edit: both machines are on the same network.)

I am using JBoss 3.2.5 and Java 1.4.2_11 on both boxes.

I stripped everything out to just test getting an email sent, so here is my code (using sample found here: http://www.javacommerce.com/displaypage.jsp?name=javamail.sql&id=18274):



[ January 19, 2007: Message edited by: Jennifer Bhamoo ]
[ January 19, 2007: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

Moved to Other Java APIs where the JavaMail-savvy hang out.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Aaron Arakawa
Greenhorn

Joined: Jan 19, 2007
Posts: 1
I think you may want to use Session.getInstance() instead of getDefaultInstance(). On your server if a default Session has already been created in the same JVM, it will ignore the properties containing mail.smtp.host = ... (according to the javadocs).
http://java.sun.com/products/javamail/javadocs/javax/mail/Session.html
Jennifer Bhamoo
Ranch Hand

Joined: Mar 09, 2002
Posts: 47
Thank you thank you!!!

That worked, I have been staring at this for over a week now!!!

Thanks again,
Jennfier
 
Consider Paul's rocket mass heater.
 
subject: JavaMail works on one server, but not another