Postbox contains rudimentary support for AppleScript – enough to enable certain features and integrations with other apps. However, we do not provide or support a full AppleScript dictionary or suite of actions.
For the adventurous, here are some sample scripts that you can use for sending messages.
Please note that Postbox Technical Support does not provide consulting or support for AppleScript development.
Example Apple Script
-- open a compose window populated with the the following parameters: -- aRecipient e-mail address of the recipient -- aSubject the message subject (optional) -- aMessageBodyText the text to appear in the compose body (optional) -- aAttachmentPath file path to the attachment to be included (optional) -- aCcRecipients a list of cc recipients (optional) -- aBccRecipients a list of bcc recipients (optional) on send_mail(aRecipientAddress, aSubject, aMessageBodyText, aAttachmentPath, aCcRecipients, aBccRecipients) tell application "Postbox" send message subject aSubject recipient aRecipientAddress cc recipients aCcRecipients bcc recipients aBccRecipients body aMessageBodyText attachment aAttachmentPath with args activate end tell end send_mail -- Send in the background with out opening a compose window with the following parameters: -- aRecipient e-mail address of the recipient -- aSubject the message subject (optional) -- aMessageBodyText the text to appear in the compose body (optional) -- aAttachmentPath file path to the attachment to be included (optional) on send_mail_in_background(aRecipientAddress, aSubject, aMessageBodyText, aAttachmentPath) tell application "Postbox" send message subject aSubject recipient aRecipientAddress body aMessageBodyText attachment aAttachmentPath with in background and args activate end tell end send_mail_in_background -- open a compose window populated with the the following parameters -- aRecipients an applescript list of e-mail addresses to send to -- aSubject the message subject (optional) -- aMessageBodyText the text to appear in the compose body (optional) -- aAttachmentPath file path to the attachment to be included (optional) on send_mail_to_recipients(aRecipients, aSubject, aMessageBodyText, aAttachmentPath) tell application "Postbox" send message subject aSubject recipients aRecipients body aMessageBodyText attachment aAttachmentPath with args activate end tell end send_mail_to_recipients
Example Calls
Here are several examples of how to call these helper methods
send_mail("stoakron@postbox-inc.com", "", "", "") send_mail("Scott MacGregor ", "", "", "") send_mail("Sto Akron <stoakron@postbox-inc.com>, Sherman Dickman <thisisatest@postbox-inc.com>", "This is a Subject", "This is a message Body.", "~/Desktop/test.txt", ["john doe ", "peter paul "], ["Steve Smith "]) send_mail_in_background("stoakron@postbox-inc.com", "This is a Subject", "This is a message Body\nwith line returns\n", "~/Desktop/test.txt") send_mail_in_background("stoakron@postbox-inc.com", "This is a Subject", "This is a message Body.", "~/Desktop/test.txt:~/Desktop/test2.txt")
Additional Notes
- To insert line returns in the message body parameter, you may need to use \n for each line return.
- To insert multiple attachments, separate them by a ':' such as "~/Desktop/test.txt:~/Desktop/test2.txt"