Desktop.mail can open outlook with the subject and receipt but it does not support the attachment (RFC 2368)
JMail only supports SMTP, does not support outlook (?)
JMAPI does not support 64bit
The most flexible way should by using VBA
Or use autoit as the general solution
import java.awt.AWTException;
import java.awt.Desktop;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.net.URI;
public class MailService {
public static void main(String[] args) throws IOException, AWTException {
Desktop desktop = Desktop.getDesktop();
//does not support attachment
String message = "mailto:myaccount@gmail.com?subject=New_Profile&body=seeAttachment&Attachment=C:/data/readme.txt";
URI uri = URI.create(message);
desktop.mail(uri);
Robot robot =new Robot();
robot.delay(2000);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_ENTER);
robot.delay(2000);
robot.keyRelease(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_CONTROL);
System.exit(0);
}
}
No comments:
Post a Comment