Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Java in General and the fly likes Send email from Outlook Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Send email from Outlook" Watch "Send email from Outlook" New topic

Send email from Outlook

Tirthankar Mukherjee
Ranch Hand

Joined: Apr 08, 2006
Posts: 51
Is there any way to send an email from MS Outlook from Java? I googled a lot and found something called JACOB, but I am not sure how to use it.

Thanks in advance.
Greg Charles

Joined: Oct 01, 2001
Posts: 2867

Do you actually need your Java application to take control over an Outlook client to send the mail? In that case, JACOB might help you, but it wouldn't be a trivial thing to do.

Much easier would be to use the Java Mail API to make your Java program a mail client to your Exchange server, which is I assume how your Outlook sends out mail. Would that fit your requirement?
Tirthankar Mukherjee
Ranch Hand

Joined: Apr 08, 2006
Posts: 51
My application won't have all the details to configure java mail, but MS Outlook would be configured where the program would execute. I just want to send a email with an attachment (.jpg/.png)
Paul Clapham

Joined: Oct 14, 2005
Posts: 19359

The answer may be yes, sort of. Outlook can be controlled by external programs like that, I used to have a Visual Basic program which did it.

But versions of Outlook since 2003 have had the security feature where when an external program calls Outlook's send-mail feature, it waits until the person sitting at the screen confirms that it's okay to do that.

Frankly it would be easier to use JavaMail. If you can configure Outlook with the address of the mail server, you can certainly configure your application with the same address. I would invest more time in looking at that simple option rather than being dead-set on the horribly complex Outlook-driving option.
Tirthankar Mukherjee
Ranch Hand

Joined: Apr 08, 2006
Posts: 51
Thanks for your time, I got your point.
Have you tried LearnNowOnline?
subject: Send email from Outlook