Description

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

Syntax

RTI_CDOMail(mailservername,sendername, recipient, subject, body,cc, bcc, replyto, content, attachmentfilelist, Username, Password, useSSL)

Parameters

The function has the following parameters:

ParameterDescription
mailservernameThe IP address of the mailserver.
sendernameThe email address of the sender of the email.
recipientThe email address of the receiver of the email.
subjectThe subject of the mail message.
bodyThe body of the mail message. This is text that is sent if the file to send is not able to be sent.
ccAdditional recipients of the mail message. Multiple email addresses can be delimited by either semicolons (;) or value marks (@vm).
bccAdditional 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).
replytoThe email address of the party that will receive any replies from the mail message.
contentThe override parameter of the default header types.
 e.g.
 'Content-Type: text/plain' (plain email minus attachments)
 'Content-Type: multipart/mixed; boundary="_-_-_-_"' (for when you want email plus attachments)
 Setting the content parameter will interfere with all the header settings, and may cause problems with attachments (unless you take full control and build these into the email yourself).
attachmentfilelistAn @vm-delimited list of files to be attached to the email. The list should contain both paths and filenames.
usernameThe username of the mail account.
passwordThe password of the mail account.
useSSLA boolean flag. When TRUE$ SSL will be used when mailing.

Returns

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

Remarks

This function was built using the CDO.Net objects. Refer to your operating system configuration for errors regarding CDO.

See also

CreateEngine()

Example

mailservername = 'my.mailserver.com'
mailserverPort='999';* use the proper port
mailServer = mailServerName:':':mailserverPort
username = 'my_username'
password = 'my_password'
useSSl = 1
body = 'This is a test of CDO Mail''
retval = rti_cdoMail( mailserver, sendername, recipient, subject, body, cc, bcc, replyto, content, attachmentfilelist, username, password, useSSl )
  • No labels

2 Comments

  1. There is an interesting discussion between Bruce Cameron and Bryan Shumsky about the proper use of the Content argument. Rather than attempt to translate I am simply going to refer people to the discussion thread labelled RTI_CDOMail - Content argument.

    The main issue of interest is that the Content argument is not intended to be used on a normal basis, but if there is a need to submit a custom Content-Type settings, the Body and Content-Type are to be submitted as a single delimited array. Seems confusing to me at first blush, but anyone who has need to do this should review the thread first.

  2. Barry Stevens found out through the WORKS forum that there is an undocumented argument called otherOptions. Thus, the full calling signature for this routine is:

    RTI_CDOMail(mailservername,sendername, recipient, subject, body,cc, bcc, replyto, content, attachmentfilelist, Username, Password, useSSL, otherOptions)

    I checked the OpenInsight 10 Programmer's Reference Guide and it does mention this argument but gives it the name extraOptions. The description for this argument is as follows:

    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.

    Fortunately, Bryan Shumsky provided more comprehensive documentation in this post. Here is what he wrote:

    Otheroptions is an optional dynamic array. Field 1 is an @VM delimited list of options that RTI_CDOMAIL supports. Right now, the supported option names are:

    version
    timeout
    priority
    receipt

    Field 2 is an associated @VM list of values for the option(s) that are specified. The values allowed for the options include:

    version: either "4" or "2" to use .net 4 or .net 2
    timeout: the maximum amount of time (in milliseconds) that the "service point" can remain idle before timing out
    priority: either "1" or "-1" to set priority to "high" or "low", respectively
    receipt: the email address to send the read receipt to

    So, to just use a read receipt, you might say something like this:

    otheroptions = ""
    otherOptions<1> = "receipt"
    otherOPtions<2> = "fake_address@somewhere.com"

    And if you wanted to send a read receipt _and_ set the email to a high priority, you might try this instead:

    otherOptions = ""
    otherOptions<1> = "priority":@VM:"receipt"

    otherOptions<2> = "1":@VM:"fake_address@somewhere.com"