appSendEmail
Version 24.3.9106
Version 24.3.9106
appSendEmail
Sends an email using the server information (such as SMTP server, user, and password) from the Alerts section of the Settings page.
Required Parameters
- To: A comma-separated list of addresses where the email should be sent.
- Subject: The subject line for the outbound email.
- Message: The plain text body of the email to send (do not use if the message is HTML).
- Html: The HTML body of the email to send (do not use if the message is plain text).
Optional Parameters
- Attachment#: An array of filepaths corresponding to the files to attach to the message. To override the name of an attachment you are pointing to on disk, you can use AttachmentName#. Alternatively, use this parameter to provide file names for attachments when creating attachments using the AttachmentData# parameter.
- AttachmentData#: An array of base64-encoded data blobs that are treated as file contents for attached files. When you use this parameter, you must also use the Attachment# parameter to name the attached files.
- AttachmentName#: An array of filenames used to name the files attached to the message (only used when renaming attachments from filepaths using Attachment#).
Examples
Send Simple Email
Here is a simple example of the appSendEmail operation. The script uses the email account configured on the Alerts tab of the application to send an email to the two email addresses listed in email.To
.
<!-- Send Simple Email -->
<arc:set attr="email.To" value="[email protected],[email protected]"/>
<arc:set attr="email.Subject" value="Lorem ipsum dolor sit amet."/>
<arc:set attr="email.Message" value="File [FileName] was processed in the connector [ConnectorId]."/>
<arc:call op="appSendEmail" in="email"/>
Including Attachments
This example uses the Attachment# and AttachmentData# attributes to create attachments on the email.
<!-- Send Email with Attachments -->
<arc:set attr="email.To" value="[email protected],[email protected]"/>
<arc:set attr="email.Subject" value="Lorem ipsum dolor sit amet."/>
<arc:set attr="email.Message" value="This is a test."/>
<arc:set attr="email.Attachment#1" value="foo.txt"/>
<arc:set attr="email.AttachmentData#1" value="TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gRG9uZWMgcG9ydHRpdG9yIGlkIG1pIG5lYyBpbXBlcmRpZXQuIE51bGxhLg=="/>
<arc:set attr="email.Attachment#2" value="bar.txt"/>
<arc:set attr="email.AttachmentData#" value="TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gTnVsbGEgYXVndWUgbWFzc2EsIGZyaW5naWxsYSBuZWMgbHVjdHVzIG5lYy4="/>
<arc:call op="appSendEmail" in="email"/>