Description

This function will send emails from OpenInsight using authenticated logins and/or a Secure Sockets Layer (SSL).

Available in OpenInsight 9.4 or later.

Syntax

Response = RTI_SendMail(mailservername, sendername, recipient, subject, body, cc, bcc, replyto, content, attachmentfilelist, Username, Password, useSSL, extraOptions)

Parameters

The function has the following parameters:

ParameterDescription

mailservername

The IP address of the mailserver.

sendername

The email address of the sender of the email.  This value may be either a simple string (the email address of the sender), or both a sender name and email address (separated by @FM).

recipient

The email address of the receiver of the email. Multiple email addresses can be delimited by either semicolons (;) or value marks (@vm). These values may be either simple strings (the email addresses of the recipients) or both recipient names (in field 1) and email addresses (in field 2).

subject

The subject of the mail message.

body

The body of the mail message.  This is text that is sent if the file to send is not able to be sent.

cc

Additional recipients of the mail message.  Multiple email addresses can be delimited by either semicolons (;) or value marks (@vm). These values may be either simple strings (the email addresses of the recipients) or both recipient names (in field 1) and email addresses (in field 2).

bcc

Additional recipients of the mail message.  These recipients are unknown to all other recipients. Multiple email addresses can be delimited by either semicolons (;) or value marks (@vm). These values may be either simple strings (the email addresses of the recipients) or both recipient names (in field 1) and email addresses (in field 2).

replyto

The email address of the party that will receive any replies from the mail message.  This value may be either a simple string (the email address to reply to), or both a reply to name and email address (separated by @FM).

content

The content parameter specifies the html or alternate view of the email.  Specify the alternate view (as either an html string or plain text) as the first field of this value, and the type of the alternate view (either “text/html”, or “text/plain” as appropriate) as the second field of this value.  The alternate view may also be generated from an operating system (Windows) file; specify the file name (including file path) as the first field of the content parameter, and “file” as the second field of the content parameter.

attachmentfilelist

An @vm-delimited list of files to be attached to the email.  The list should contain both paths and filenames.

username

The username of the mail account.

password

The password of the mail account.

useSSL

A boolean flag.  When TRUE$ SSL will be used when mailing.

extraOptions

A dynamic array of additional options for the email.  Field 1 may contain either “priority” (to set the email priority) and/or “receipt” (to specify a read receipt), @VM delimited.  Field 2 should then contain the priority value (“high”, “normal”, or “low”) and/or the email address the receipt should be sent to, in the associated value position.

Returns

OpenInsight will return the error message received from the SMTPClient.  These error message generally relate to configuration issues with SMTP.  The errors are version specific, therefore it is recommended that Microsoft's documentation for SMTPClient be referenced.

Remarks

This function was built using the .Net SMTP client library (System.Net.Mail.SmtpClient assembly).

If the body parameter is not specified, and a value is specified for the content parameter, then the email will be sent as an “html email” (the value of the content field 1 will be used as the body of the email).

Example

mailservername = 'my.mailserver.com'
mailserverPort = '999'  ;// use the proper port
mailServer = mailServerName:':':mailserverPort
sendername = 'myemail@whatever.com'
recipient = 'youremail@somewhere.com'
subject = 'Test'
body = 'This is only a test!'
username = 'my_username'
password = 'my_password'
useSSL = 1
body = 'This is a test of SMTPMail'
Response = RTI_SendMail(mailserver, sendername, recipient, subject, body, '', '', '', '', '', username, password, useSSL)
  • No labels