ASPrunnerPro32x32     ASPRunnerPro manual


Function runner_mail

<< Click to Display Table of Contents >>

Navigation:  Advanced topics > Programming topics >

ASPrunnerPro32x32     ASPRunnerPro manual


Function runner_mail

 

Description

Function runner_mail is ASPRunnerPro wrapper for email function.

Syntax

runner_mail(params)

Arguments

params - Scripting.Dictionary object with input parameters. The following parameters are supported:

from - sender email address. If none specified an email address from the wizard will be used.

to - receiver email address.

cc - email addresses of secondary recipients.

bcc - email addresses of recipients whose addresses are not to be revealed to other recipients of the message.

body - plain text message body.

htmlbody - html message body (do not use 'body' parameter in this case).

charset - html message charset. If none specified the default website charset will be used.

attachments - attachments description.

Return value

Array with the following keys:

mailed: (true or false) indicates whether email was sent or not.

message: error message in case the email was not sent

 

Examples

Send simple email

' do not forget to setup email parameters like From, SMTP server etc

' on 'Security->User login settings' dialog

set params = CreateObject("Scripting.Dictionary")

params("to")="test@test.com"

params("subject")="Sample subject"

params("body")="message"

runner_mail(params)

Send HTML email

set params = CreateObject("Scripting.Dictionary")

params("to")="test@test.com"

params("subject")="Sample subject"

params("htmlbody")="<body><html><p>Hello<br>Best regards</p></body></html>"

params("charset")="UTF-8"

runner_mail(params)

Example with error handling

set params = CreateObject("Scripting.Dictionary")

params("to")="test@test.com"

params("subject")="Sample subject"

params("body")="Hello there" & vbcrlf & "Best regards"

set result = runner_mail(params)

if not result("mailed"then

  response.write result("message")

  response.flush

end if

Send email with BCC and CC fields

set params = CreateObject("Scripting.Dictionary")

params("to")="test@test.com"

params("cc")="test2@test.com"

params("bcc")="test3@test.com"

params("subject")="Sample subject"

params("body")="message"

runner_mail(params)

Send email to multiple recipients

set params = CreateObject("Scripting.Dictionary")

params("to")="test@test.com,test2@test.com,test3@test.com"

params("subject")="Sample subject"

params("body")="message"

runner_mail(params)

Send email with attachments

dim tmpDict

set tmpDict = CreateObject("Scripting.Dictionary")

tmpDict("to")="test@test.com"

tmpDict("subject")="Sample subject"

tmpDict("body")="Hello there" & vbcrlf & "Best regards"

set attachments = CreateObject("Scripting.Dictionary")

attachments(0) = getabspath("files/1.jpg")

attachments(1) = getabspath("files/2.jpg")

set tmpDict("attachments") = attachments

set ret=runner_mail(tmpDict)

if not ret("mailed") then

    response.write ret("message")

end if