Sends an email using TLS security protocol.

Added in 2.2

Syntax

Status = SRP_Mail("Send", Server, Subject, Sender, Recipients, Body, Attachments, Importance)

Returns

If the email sends successfully, then 1 is returned. If the email cannot be sent, then a string describing the error is returned.

Parameters

ParameterDescription
ServerServer address, username, and password. (See Remarks) Required.
SubjectSubject line of the email.
SenderSingle email address indicating who the email is from. Required.
RecipientsEmail addresses to whom the email will be sent. Includes Cc and Bcc. (See Remarks) Requires at least one.
BodyBody of the email. Support HTML formatting.
Attachments@FM or @VM delimited list of filenames to be attached to the email.
Importance"Low", "Normal", or "High". Default is "Normal" if omitted.

Remarks

The Send service sends an email on port 587 using the TLS security protocol. This is the recommended service for sending most emails, but if your server does not support TLS, you can use SendUnsecure instead.

Server

The Server parameter is a multivalued structure containing three discreet fields.

FieldNameDescription
<1>
AddressThis is the server's address (e.g., smtp.gmail.com) or direct IP address.
<2>
UsernameThis is the username required to log into the server to send an email.
<3>
PasswordThis is the password required to log into the server to send an email.

Subject

This is the text that will appear in the subject line of your email.

Sender

This is the email address of the one sending the email. You may optionally include a name with email by using the format "name(email)", e.g., "John Doe (johndoe@mydomain.com)"

Recipients

The Recipients parameter is a multivalued structure with the following fields:

FieldNameDescription
<1>
ToA comma delimited list of email addresses. To pass name with email, use format name(email). There must be at least one email here.
<2>
CcA comma delimited list of carbon-copy email addresses. To pass name with email, use format name(email).
<3>
BccA comma delimited list of blind carbon-copy email addresses. To pass name with email, use format name(email).

Note: The emails in these fields are comma delimited, not @VM delimited.

Body

This is the text that appears in the body of the email. If you want to pass formatted text, you must pass well-formatted HTML beginning with <html> and ending with </html>. Failure to do so will cause this service to think you are passing plain text.

Attachments

This is an @FM or @VM delimited list of file paths pointing to existing files you want attached to the email when sent.

Importance

This optional parameter lets you specify the importance level of the email. Note that not all email clients pay attention to this field, so your mileage may vary. You may pass "Low", "Normal", or "High". Leave this blank to set the importance to Normal.

Example

$insert SRPMAIL_INSERTS 

Server = ""
Server<1> = "mymail.somedomain.com"
Server<2> = "myusername"
Server<3> = "password"

Result = SRP_Mail("Send", Server, "Test Subject Line", "myemail@somedomain.com", "myfriend@somedomain.com", "Hello World!")
  • No labels