Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: c080014c15
Fetching contributors…

Cannot retrieve contributors at this time

file 21 lines (14 sloc) 0.73 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
var mail = SBApplication.application_("Mail");

var to = "someone@somewhere.com";
var from = "someone@somewhere.com";
var subject = "This is the subject.";
var content = "This is the message content.\n\nIsn't it great?";

var emailMessageProps = {subject:subject, content:content};
var emailMessage = mail.classForScriptingClass_("outgoing message").alloc().initWithProperties_(emailMessageProps);

mail.outgoingMessages().addObject_(emailMessage);

emailMessage.sender = from;
emailMessage.visible = true;

theRecipientProps = {address:from};
theRecipient = mail.classForScriptingClass_("to recipient").alloc().initWithProperties_(theRecipientProps);

emailMessage.toRecipients().addObject_(theRecipient);

emailMessage.send();
Something went wrong with that request. Please try again.