• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1552
  • Last Modified:

Launch outlook with pre-populated fields and attachments in java

Is it possible to launch outlook with some fields pre-populated (from, to, subject) and attachments attached to the email inside a java application?

Thanks!
0
mybluegrass
Asked:
mybluegrass
  • 8
  • 7
  • 2
1 Solution
 
for_yanCommented:

Do you really want to lauvnch outlook or you want to send an email
form java appalications?
If so JavaMail is the best way to dio it
0
 
for_yanCommented:
You can use JavaMail to send email and can do attachements list of addresse, etc.
And you can make a simple application wehe people cn modify or edit the email before sending

If your purpiose is to send email JavaMai is every convenient.
No doubt you can launch outlook from Java but this will be much bigger overhead and less flexible in many senses
0
 
mybluegrassAuthor Commented:
I have already used javamail to send email inside my servlet. But I also need to launch outlook so users can use their outlook address book, signature, etc. Thanks!
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
for_yanCommented:
Well, then you can use Runtime.getRuntime().exec... to start it, but do you want it to come
up with some particular screen say sending email?
0
 
for_yanCommented:

You can start it wioth switches as specified on this page (click on switch reference)
http://office.microsoft.com/en-us/outlook-help/command-line-switches-HP001003110.aspx
There are lots of options there
0
 
mybluegrassAuthor Commented:
Will Runtime.getRuntime().exec allow me to pre-populate some fields and attach files sent from server? The mailto function can pre-populate some fields but just not attachments. I'm afraid it's a security issue and not even possible. Thanks!
0
 
for_yanCommented:
Check these switches - maybe you are right - maybe no attachements there, but a lot of
options.
The other thing to consider, that most of the users may alreday have Outlook opened,
so there may be some issues with that.
In general, if possible, I'd rather avoid such situation.
If you knoe already a lot about their message, then use JavaMail,
otherwise, maybe you would just offer them to send themselves through outlook.

This intermediate suituation is possible, but when you start getting into details
 may have some clashes and inconveniences and some differences on dofferent desktops, etc.
That's at least my opinion.


0
 
for_yanCommented:
In general Runtime.getRuntime().exec  should of course accept switches, etc. everything what command line accepts
0
 
objectsCommented:
> Is it possible to launch outlook with some fields pre-populated (from, to, subject) and attachments attached to the email inside a java application?

afaik its not possible
0
 
mybluegrassAuthor Commented:
I see that the switches allow me to attach a file, but I didn't see a switch to allow me to include to, cc or subject field. Thanks!
0
 
mybluegrassAuthor Commented:
Never mind. Found the solution here:
http://stackoverflow.com/questions/248569/starting-outlook-and-having-an-email-pre-populated-from-command-line

Just have to add
/m name@email.com&cc=name2@email.com&subject=test%20subject
0
 
for_yanCommented:
Great!
0
 
mybluegrassAuthor Commented:
Is there a way to attach multiple attachments using switch /a?

Thanks!
0
 
for_yanCommented:
I don't know but you can try with different syntax

/a oneFile /a twoFile

or maybe

/a oneFile,twoFile

just try
0
 
mybluegrassAuthor Commented:
I've tried different variations including what you've suggested. But none works. I'm wondering that it's possible or not. Thanks!
0
 
mybluegrassAuthor Commented:
It seems that it's not possible to attache multiple attachments using the switch:

http://www.pcreview.co.uk/forums/do-launch-outlook-multi-attachments-using-command-line-t2343640.html

Has anyone done this before? If not, what will be the alternative?

Thanks!
0
 
objectsCommented:
as I mentioned earlier what you are attempting is not possible.
There are no workarounds that I am aware of  (except of course zipping all the files into one)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 8
  • 7
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now