Lasso Soft Inc. > Home

[ Email_Send ]

Method

[Email_Send] queues an email message for sending. The email message is sent within a couple minutes by an automatic background process.

The current Email Queue can be viewed in Lasso Administration in the Monitors > Email Queue section which is accessible at http://example.com/lasso9/admin/email (replace "example.com" with your domain).

The method requires that the -From and -Subject parameters have values. Either the -Body or -HTML parameter should also be specified. The -Body parameter will generate a plain text email. The -HTML parameter will generate an HTML email. Specifying both will send a multi-part/alternative email.

At least one of -To, -CC, and -BCC must contain valid email addresses. Multiple email addresses can be specified separated by commas, but use of the real name and email address is not supported.

The -Host parameter is required if you wish to use an external SMTP server which is preferred. If a -Username and -Password are specified they will be used for SMTP AUTH authorization at the specified host. The -Username, -Password, -Timeout, and -Port parameters will only be used if a -Host parameter is specified as well.

The optional -Attachments parameter can be set to the file path for a single file that should be included as an attachment to the email message or to an array of file paths. The attached file(s) should be within the Web server root and the path(s) should be specified relative to the current page or to the Web server root.

The optional -ReplyTo parameter can be used to set the email address that replies to this message should go to.

The optional -ExtraMIMEHeaders parameter can be set to an array of name/value pairs which define extra headers that should be included with the email message. For example, a "Reply To" header could be included in this way.

The optional -Priority parameter can be used to set the email priority. Valid values are 'Low', 'Medium', and 'High'. A higher priority will be sent processed out of the email queue before a lower priority email message.

The optional -Sender parameter can be used to set which email address should be reported as the sender.

The optional -ContentType parameter can be used to specify the Content-Type header for the message

The optional -TransferEncoding parameter can be used to set the Transfer-Encoding header for the message.

The optional -CharacterSet parameter can be used to specify the character set the message should be encoded as.

The optional -Date parameter can be used to set when a message should be sent by passing the parameter a Lasso [Date] object. Useful for creating messages to send in the future.

The optional -Immediate parameter can be used to skip the queue and send the message immediately. This message should be used sparingly for important messages or message that exceed the maximum message size allowed for the email queue.

Lasso allows for creating template emails that can be customized based on the recipient. The -Tokens parameter takes a map of token names and values that will be the same for every email message while the -Merge parameter takes a map of email addresses, each with it's own map of token names and values. The token values in the -Merge map overrides the values in the -Tokens map. See [email_token] for more information.

  • Syntax
email_send(
	-host='Host Name',
	-to='Recipient Email Address',
	-from='Sender Email Address',
	-subject='Email Subject',
	-body='Email Body Text'
)

email_send(
	-host='Host Name',
	-to='Recipient Email Address',
	-cc='Recipient Email Address',
	-bcc='Recipient Email Address',
	-from='Sender Email Address',
	-subject='Email Subject',
	-body='Email Body Text'
)

email_send(
	-host='Host Name',
	-to='Recipient Email Address',
	-from='Sender Email Address',
	-subject='Email Subject',
	-body='Email Body Text',
	-attachments='Attachment Path',
	-extraMimeHeaders='Headers Pair Array'
)

email_send(
	-host = 'string', 
	-port = integer, 
	-timeout = integer, 
	-username = 'string', 
	-password = 'string', 
	-priority = 'immediate', 
	-to = 'string', 
	-cc = 'string', 
	-bcc = 'string', 
	-from = 'string', 
	-replyto = 'string', 
	-sender = 'string', 
	-subject = 'string', 
	-body = 'string', 
	-html = 'string', 
	-transferencoding = 'string', 
	-contentType = 'string', 
	-characterset = 'string', 
	-attachments = '/path/to/myFile.txt', 
	-extramimeheaders = 'Headers Pair Array', 
	-date = date, 
	-immediate = boolean
)
Examples
  • Beginner

To send an email from a format file:

Use the [Email_Send] method. The following example sends an email to administrator@example.com through the server mail.example.com each time the page is visited. The contents of the email is the current date and time.

Code

email_send(-host='mail.example.com',
  -to='administrator@example.com',
  -from='administrator@example.com',
  -subject='A page visit!',
  -body=date_getCurrentDate
)

Result

It adds the email to the queue

To send an email with the contents of a format file:

Use the [Email_Send] method. The following example sends an email to administrator@example.com through the server mail.example.com each time the page is visited. The contents of the format file format.lasso is used as the body of the email message.

Code

email_send(-host='mail.example.com',
  -to='administrator@example.com',
  -from='administrator@example.com',
  -subject='A page visit!',
  -body=include('format.lasso')
)

Result

Sends an email message whose contents are taken from processing the file 'format.lasso'

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft