This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes Java Mail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Java Mail" Watch "Java Mail" New topic

Java Mail

Vivek Vasudevan

Joined: Sep 01, 2004
Posts: 5

I am basically tring to send an email via Microsoft outlook using the Javamail API. And right now I am facing a problem which is giving me quite a headache.
In the piece of code below....

// Get system properties
Properties props = System.getProperties();

// Setup mail server
props.put("", SMTPhost);

However in the standard code above I have to specifically mention what the SMTP host is. Is there any way by which I neednt specify it implicitly. Is there any piece of code that automatically finds out which SMTP server the MS outlook is connected out.

I really hope some one would help me out.Thanks a million....make that a zillion

Vivek Vasudevan<br />"Today is the first day of the rest of your life"
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

I am basically tring to send an email via Microsoft outlook using the Javamail API

No you are not - at least not if you are using JavaMail (If you were using JNI and CDO perhaps, but not with JavaMail). Outlook is not involved in JavaMail at all.

Why? Because Outlook is just a Mail User Agent - in the same way your Java program is. Both will need to know which sever to use. I don't think Outlook keeps its configuration data anywhere easily accessable (like an ini file or something) so I don't think there is an easy way to get this.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Have you checked out Aspose?
subject: Java Mail
It's not a secret anymore!