Sends an email using the SMTP protocol.
Syntax
Result = SRP_Send_Mail(Message, Config)
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
Parameter | Description |
---|---|
Message | The email information |
Config | The settings for how the email will be sent |
Remarks
As of 2.2, SRP Mail requires RevDotNet. You must run OpenInsight's Client Install to ensure RevDotNet is functional.
The first parameter describes the contents and destination of the email. It has the following structure:
Field | Name | Description |
---|---|---|
<1> | Subject | The text to appear the subject line of the email |
<2> | From | The email address of the sender. To pass name with email, use format name(email). You cannot leave this blank. |
<3> | To | A comma delimited list of destination email addresses. To pass name with email, use format name(email). There must be at least one email here. |
<4> | Cc | A comma delimited list of carbon-copy email addresses. To pass name with email, use format name(email). |
<5> | Bcc | A comma delimited list of blind carbon-copy email addresses. To pass name with email, use format name(email). |
<6> | Reply To | A single email address to which replies will be sent. Passing name with email not supported. If blank, replies will be sent to the email address in the From field |
<7> | Body Type | If the body contains HTML tags, set this to "HTML." If not, leave this field blank or set it to "TEXT" |
<8> | Body | The email content |
<9> | Attachments | An @VM delimited list of paths to files to be attached. (Full paths only. No relative paths) |
<10> | Importance | The email's importance level. Set this field to one of three values: SRPMail_Importance_Low$, SRPMail_Importance_Normal$, or SRPMail_Importance_High$ |
<11> | Unused | Leave blank. (This used to be a flag for requesting Read Receipts, but most APIs and servers no longer support this feature.) |
<12> | Delivery Confirmation Requested | Requests confirmation that your email was delivered when set to 1. |
The second parameter establishes the SMTP server to be used and how to connect to it. It has the following structure:
Field | Name | Description |
---|---|---|
<1> | Unused | Leave blank. |
<2> | Unused | Leave blank. |
<3> | Server Port | The SMTP service port. Most servers use 25 for non-encrypted use or 587 for TLS encryption. |
<4> | Server Address | The SMTP server name or IP address. (For example: mail.mydomain.com) |
<5> | Authenticate | Set this to 1. Nearly all email service provider require authentication. |
<6> | Username | Your email account's username |
<7> | Password | Your email account's password |
<8> | Use TLS | Set this field to 1 or "TLS" if you need the email transported the TLS security protocol. Set it to 0 or leave it blank if encrypted security is not desired (though this is not recommended). As of 2.2, SSL is no longer supported. Email service providers that support SSL should also support TLS, and TLS is considered more secure. Many SMTP APIs have stopped supporting SSL for this reason. |
Example
$insert SRPMAIL_INSERTS Config = "" Config<3> = 587 Config<4> = "mymail.somedomain.com" Config<5> = 1 Config<6> = "myusername" Config<7> = "password" Config<8> = "TLS" Message = "" Message<1> = "Subject Line" Message<2> = "myemail@somedomain.com" Message<3> = "myfriend@somedomain.com" Message<4> = "" Message<5> = "" Message<6> = "" Message<7> = "TEXT" Message<8> = "Hello World!" Message<9> = "" Message<10> = SRPMail_Importance_Normal$ rv = SRP_Send_Mail(Message, Config)