Integrated eMail Support

Using Omni Automation you can construct and manipulate outline documents, apply styles and import data from a variety of sources. And with integrated scripting support for creating and sending email, it becomes easy to automate the sending of outline content and documents. The following documentation demonstrate how to access and use this ability, beginning with a set of parameters for generating an email.

Constructor

Omni Automation in OmniGraffle supports an Email class, design for creating and sending electronic mail messages. To instantiate an instance of this class, it is preceded by the new constructor.

Instance Properties

As with most scriptable objects, an instance of the Email class has properties that define its design and usage. Here is the list of properties for this class:

Instance Functions

The Email class contains a single command generate() for processing instances of the class.

var email = new Email() email.subject = "Omni Automation" email.body = "Greetings!\n\nHere are my suggestions regarding Omni Automation:" email.receiver = "support@omnigroup.com" email.generate()
omnigraffle://localhost/omnijs-run?script=try%7Bvar%20email%20%3D%20new%20Email%28%29%0Aemail%2Esubject%20%3D%20%22Omni%20Automation%22%0Aemail%2Ebody%20%3D%20%22Greetings%21%5Cn%5CnHere%20are%20my%20suggestions%20regarding%20Omni%20Automation%3A%22%0Aemail%2Ereceiver%20%3D%20%22support%40omnigroup%2Ecom%22%0Aemail%2Egenerate%28%29%7Dcatch%28err%29%7Bconsole%2Elog%28err%29%7D

Including Attachments

The following are examples of creating and sending mail messages whose contents are derived from the current document.

NOTE: The image attachment in the following example is created using the current document export settings.

var docName = document.name var fileTypeID = 'public.png' var wrapperPromise = document.makeFileWrapper(docName, fileTypeID) wrapperPromise.then(function(wrapper){ var email = new Email() email.subject = "PNG of “" + docName + "”" email.body = "Here is the exported canvas for you!\n\n" email.fileWrappers = [wrapper] email.generate() }) wrapperPromise.catch(function(err){ console.error(err.message) })
omnigraffle://localhost/omnijs-run?script=try%7Bvar%20docName%20%3D%20document%2Ename%0Avar%20fileTypeID%20%3D%20%27public%2Epng%27%0Avar%20wrapperPromise%20%3D%20document%2EmakeFileWrapper%28docName%2C%20fileTypeID%29%0A%0AwrapperPromise%2Ethen%28function%28wrapper%29%7B%0A%09var%20email%20%3D%20new%20Email%28%29%0A%09email%2Esubject%20%3D%20%22PNG%20of%20%E2%80%9C%22%20%2B%20docName%20%2B%20%22%E2%80%9D%22%0A%09email%2Ebody%20%3D%20%22Here%20is%20the%20exported%20canvas%20for%20you%21%5Cn%5Cn%22%0A%09email%2EfileWrappers%20%3D%20%5Bwrapper%5D%0A%09email%2Egenerate%28%29%0A%7D%29%0A%0AwrapperPromise%2Ecatch%28function%28err%29%7B%0A%09console%2Eerror%28err%2Emessage%29%0A%7D%29%7Dcatch%28err%29%7Bconsole%2Elog%28err%29%7D
var docName = document.name var OGDwrapperPromise = document.makeFileWrapper(docName, "com.omnigroup.omnigraffle.graffle") var PNGwrapperPromise = document.makeFileWrapper(docName, "public.png") var promises = [PNGwrapperPromise,OGDwrapperPromise] Promise.all(promises).then(function(wrappers){ var email = new Email() email.subject = "Exports of “" + docName + "”" email.body = "Here are the exported canvas and file:\n\n" email.fileWrappers = wrappers email.generate() }).catch(function(err){ console.log("Error", err.message) })
omnigraffle://localhost/omnijs-run?script=try%7Bvar%20docName%20%3D%20document%2Ename%0Avar%20OGDwrapperPromise%20%3D%20document%2EmakeFileWrapper%28docName%2C%20%22com%2Eomnigroup%2Eomnigraffle%2Egraffle%22%29%0Avar%20PNGwrapperPromise%20%3D%20document%2EmakeFileWrapper%28docName%2C%20%22public%2Epng%22%29%0Avar%20promises%20%3D%20%5BPNGwrapperPromise%2COGDwrapperPromise%5D%0A%0APromise%2Eall%28promises%29%2Ethen%28function%28wrappers%29%7B%0A%09var%20email%20%3D%20new%20Email%28%29%0A%09email%2Esubject%20%3D%20%22Exports%20of%20%E2%80%9C%22%20%2B%20docName%20%2B%20%22%E2%80%9D%22%0A%09email%2Ebody%20%3D%20%22Here%20are%20the%20exported%20canvas%20and%20file%3A%5Cn%5Cn%22%0A%09email%2EfileWrappers%20%3D%20wrappers%0A%09email%2Egenerate%28%29%0A%7D%29%2Ecatch%28function%28err%29%7B%0A%09console%2Elog%28%22Error%22%2C%20err%2Emessage%29%0A%7D%29%7Dcatch%28err%29%7Bconsole%2Elog%28err%29%7D
mail-logo-file
UNDER CONSTRUCTION

This webpage is in the process of being developed. Any content may change and may not be accurate or complete at this time.

DISCLAIMER