vbscript - How to open outlook using javaScript on client machine? -
i have java code open outlook in server . want opent outlook on client machine , fill body html content . possible using javascript , vbscript or other technology .
public static void main(string[] args) { // system.setproperty("java.library.path", "/path/to/library"); display display = display.getcurrent(); shell shell = new shell(display); oleframe frame = new oleframe(shell, swt.none); // should start outlook if not running yet oleclientsite site = new oleclientsite(frame, swt.none, "ovctl.ovctl"); site.doverb(ole.oleiverb_inplaceactivate); // outlook application oleclientsite site2 = new oleclientsite(frame, swt.none, "outlook.application"); oleautomation outlook = new oleautomation(site2); // oleautomation mail = invoke(outlook, "createitem", 0 /* mail item */) .getautomation(); setproperty(mail, "to", "testto@gmail.com"); /* * empty * predefined */ setproperty(mail, "bcc", "testbcc@gmail.com"); /* * empty * predefined */ setproperty(mail, "cc", "testcc@gmail.com"); /* * empty * predefined */ setproperty(mail, "bodyformat", 2 /* html */); setproperty(mail, "subject", "top news you"); setproperty(mail, "htmlbody", "<html>hello<p>, please find infos here.</html>"); file file = new file("d:/vicky.txt"); if (file.exists()) { oleautomation attachments = getproperty(mail, "attachments"); invoke(attachments, "add", "d:/vicky.txt"); } else { messagedialog .openinformation(shell, "info", "attachment file c:/temp/test.txt not found; send email attachment"); } invoke(mail, "display" /* or "send" */); }
html - javascript: simple mailto
in html a
tag, see below simple markup.
<a href="mailto:name@gmail.com">click here mail</a>
once clicked, open outlook. (actually open default mail client)
java:
sample code: open outlook , add attachment.
new processbuilder("c:\\program files\\microsoft office\\office14\\outlook.exe","/a","c:\\desktop\\stackoverflow.txt").start();
first argument = path outlook.
second argument = outlook attachment command.
third argument = attachment path.
Comments
Post a Comment