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 OmniOutliner 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 Class instance 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.

omnioutliner://localhost/omnijs-run?script=email%20%3D%20new%20Email%28%29%0Demail%2Esubject%20%3D%20%22Contents%20of%20%E2%80%9C%22%20%2B%20document%2Ename%20%2B%20%22%E2%80%9D%22%0Demail%2Ebody%20%3D%20%22Whatever%20content%20you%20wish%20to%20include%22%0Demail%2Egenerate%28%29
Basic eMail Script
 

email = new Email() email.subject = "Contents of “" + document.name + "”" email.body = "Whatever content you wish to include" email.generate()

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

Send Basic Text of Outline

As an example of an Omni Automation action that creates an outgoing mail message containing the contents of the current OmniOutliner document as plain tabbed text:

NOTE: On iOS and iPadOS leading spaces and tabs may be stripped from the message body.

[see Export Outline page for details regarding FileWrappers]

Send Outline as Tabbed Text
  

/*{ "type": "action", "targets": ["omnioutliner"], "author": "Otto Automator", "identifier": "com.omni-automation.oo.send-outline-as-text", "version": "1.1", "description": "This action will create a new outgoing email message whose contents is the revealed outline elements as plain text with tab indents.", "label": "Send Outline as Text", "shortLabel": "Send as Text", "paletteLabel": "Send as Text", "image":"envelope.fill" }*/ (() => { const action = new PlugIn.Action(async function(selection, sender){ // action code // selection options: columns, document, editor, items, nodes, outline, styles try { baseName = document.name fileTypeID = "public.plain-text" wrapper = await document.makeFileWrapper(baseName, fileTypeID) email = new Email() email.subject = `Contents of “${baseName}”` email.body = wrapper.contents.toString() email.generate() } catch(err){ new Alert(err.name, err.message).show() } }); action.validate = function(selection, sender){ // validation code // selection options: columns, document, editor, items, nodes, outline, styles return true }; return action; })();
mail-message-with-tabbed-text