dcsimg
javamail won't use my smtp server
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Christophe_Stordeur
Posted On:   Monday, March 6, 2006 06:15 AM

hello, I have the following problem: I'm using Javamail to send mails from within my Oracle database. The javamail is called from within PL/SQL and sends binary files as attachments (PDF). This works fine, BUT: although I have to state my smtp server (which is a Windows machine), the javamail uses the Unix machine on which the database is running. So, if I look to the internet header of my mail message, I see that the mail was sent by the Unix machine. So my question is, what do I have to do to make the javamail use my smtp server instead of the Unix machine. Strangely enough, the code also works if I give a completely bogus server name as the smtp server. This proves in my opninion that this parameter is not used at all! This    More>>

hello,



I have the following problem: I'm using Javamail to send mails from within my Oracle database. The javamail is called from within PL/SQL and sends binary files as attachments (PDF). This works fine, BUT: although I have to state my smtp server (which is a Windows machine), the javamail uses the Unix machine on which the database is running.



So, if I look to the internet header of my mail message, I see that the mail was sent by the Unix machine. So my question is, what do I have to do to make the javamail use my smtp server instead of the Unix machine. Strangely enough, the code also works if I give a completely bogus server name as the smtp server. This proves in my opninion that this parameter is not used at all!



This is the code for defining the smtp server:



// Create some properties and get the default Session;
Properties props = System.getProperties();

props.put("servername.fostplus.be", SMTPServer);

Session session = Session.getDefaultInstance(props, null);

session.setDebug(true);



Thanks for your help!


Kind regards, Christophe

   <<Less

Re: javamail won't use my smtp server

Posted By:   Christophe_Stordeur  
Posted On:   Monday, March 6, 2006 09:10 AM

Thank you! This solved my problem.


Apparently, as I don't know Java at all, I set a wrong property...



Best regards


Christophe

Re: javamail won't use my smtp server

Posted By:   WarnerJan_Veldhuis  
Posted On:   Monday, March 6, 2006 07:40 AM

Javamail uses mail.smtp.host as a parameter in the porperties. So it would look like:
props.put("mail.host", "servername.fostplus.be"); More info here
About | Sitemap | Contact