Send Email To
Sends an email from the email application on the mobile device or silently via the server to one or more recipients. The email can be sent as HTML or text. You can specify the recipients, the subject, and the message of the email body via XPath expressions. Additionally, text and image attachments can be generated. The settings of the Send Email To action are shown in the screenshot below and are described further below.
|Links to update server settings do not work in Gmail and some other email applications, but they work in popular clients such as AquaMail, K9, and MailWise. They have been tested in AquaMail and K9 and work correctly in these applications. The mobiletogether:// scheme is used for MobileTogether-specific tasks such as opening a MobileTogether solution via the link or updating the server settings on a client device via the link.
Select whether the email is to be sent from the email application of the end user's client device or from the server. Compare the screenshot below (email sent from server) with the screenshot at the top of the page (client); the server option has three settings more than the client option: the From field, the Reply to field, and the OnError action.
•Client: When the action is executed, it opens an email in the email application. The email will be filled with the details specified in the action settings (address fields, subject, body, and attachments). The end user can edit the email and send it, or close the email without sending it. You can also specify whether the email is sent as HTML or text.
•Server: If the email is to be sent via the (MobileTogether) server, then MobileTogether Server must be configured to access the ISP's SMTP server. (See the MobileTogether Server documentation for a description of how to do this. Essentially, the ISP's SMTP server address and port, and the sender's email user name and password must be configured in the settings of MobileTogether Server.) When the end user carries out the event that triggers the action, the email is sent silently from the server without any further end-user interaction. Choosing to send the email via the server provides three options more than for sending from the client: the As field, the From field, and the On Error action to perform. The As field specifies whether the email should be sent as HTML or text. The From field is described below. If there is an error when sending the mail from the server, you can specify whether the Send action should be aborted, continued, or throw an error.
The email addresses that go into these fields are entered via XPath expressions. They can be (i) entered directly as strings in the XPath expression (as shown in the screenshots above), or (ii) generated from nodes in page sources (see the XPath expression below). If multiple recipients are to be specified in any of these fields, then it is best to use an XPath expression that returns a sequence. It is not advisable to hard-code separators (such as semi-colons or commas) between two email addresses since different email clients use different separators. Here is an example of an XPath expression that uses a node in an XML page source to generate an email address line:
if ( \$MT_iOS=true() ) then iosGroup/Person/Email else otherGroup/Person/Email
The expression iterates over a sequence of Person/Email nodes, each of which is expected to contain one email address. In the case of both iOS clients and non-iOS clients, multiple recipients are given as a sequence of strings: ("email@example.com", "firstname.lastname@example.org").
If you choose to send the email via MobileTogether Server, then the From and Reply To settings become available. You can specify the sender's email address in this setting. The From setting must be filled if the email is sent over an SMTP server that requires a sender's address as mandatory. If the SMTP server does not require this, you can leave the From setting empty.
Automatic replies are often sent from a "pseudo" email address, which is the address made visible to recipients. If you wish to use a "pseudo" address, enter this address in the From setting. If, in this case, you still wish to be contactable, you can enter a real email address in the Reply To setting. When the recipient clicks the Reply command in their email client, a new email will open that is addressed to the real email address that was entered in the Reply To setting.
The XPath expression for the email's Subject field can either be a string or generate the desired text from XML page sources. The XPath expression for the email's Body field must generate structured HTML, that is, an <html> element with a valid HTML sub-structure (see below).
In the screenshot above, the XPath expression for the Subject field is a directly entered string, while the expression for the body returns the content of the Message element that has its date attribute equal to "2015-04-15".
The email body must be structured HTML, that is, it must be structured as an <html> element that contains child nodes. The level of HTML support depends on the source from which the email is sent:
•From the server or from an iOS client: Standard HTML supported.
•Android: Only a few HTML constructs, such as <b>, are supported.
•Windows Phone and Windows App (tablets and touch-enabled PCs): No HTML support.
If you wish to send fully formatted HTML, select the (Send) from Server option.
Files and images can be attached to the message. You can select one of three options for attachments:
•No attachments (selected by default)
•Attachments listed below
Attachments listed below
This option allows attachments to be created individually. To add a new attachment, click . The screenshot below shows a message with two attachments. To delete an attachment, click its Delete icon.
Each attachment has the following properties:
•Filename (XPath): The filename can have any extension. The filename serves solely as a representation (in the message) of the attachment; it is not an actual path.
•Content (XPath): You can select an XML tree fragment, a single XML node, the text content of one or more nodes, or you can directly enter a string that will be the content of the attached file. The content will be parsed according to the selection in the (next) Content type property.
•Content type (combo box: XML/Base64/Text): If the content type is XML, then the content that is selected via the Content property (previous property) is parsed as XML data: an XML nodeset is expected, and the nodeset will be attached to the email. If the content type is Base64, then Base64-encoded content is expected, and this content is decoded. So, if the content is a Base64-encoding of an image, then an image is generated and attached to the email. If the content type is Text, then text is expected as content, and this text will be attached to the email. Note that the value of the Content property must be readable according to the selection made for the Content type property.
The XPath expression uses the mt-email-attachment XPath extension function to create the attachments.
You can add a hyperlink to the body of an email that is sent in HTML format. This feature does not work for emails sent as text. The link can target an Internet page or a MobileTogether solution. To add a link to the email body, use the mt-html-anchor function in the XPath expression of the Body option (see screenshot below).
The mt-html-anchor function takes two arguments: LinkText and targetURL. It uses these two arguments to create an HTML hyperlink element: <a href="targetURL">LinkText</a>
mt-html-anchor('Unregister from mailing list', 'https://www.altova.com')
generates the HTML code fragment:
<a href="https://www.altova.com'">Unregister from mailing list</a>
The example above links to an Internet page. For a description of how to link to a MobileTogether solution, see Hyperlinking to Solutions.
MobileTogether extension functions
MobileTogether provides a range of XPath extension functions that have been specifically created for use in MobileTogether designs. Some functions can be particularly useful with specific actions. For example, mt-available-languages() returns the languages in which the solution is available and could, for example, be used with the Message Box action. If a function is especially relevant to this action, it is listed below. For a full list of extension functions and their descriptions, see the topic MobileTogether Extension Functions.