Salesforce

MailSend (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

MailSend (Magic xpa 4.x)

Used to send an email. It requires all the information needed to send an email.

Syntax:

MailSend(from, to, cc, bcc, subject, message, attachment)

Parameters:

from: string, email address of sender. This is not checked, so it can basically be anything.

to: string, a comma-delimited list of main addresses. If this is incorrect, the mail will not arrive.

cc: string, a comma-delimited list of CC addresses

bcc: string, a comma-delimited list of BCC addresses

subject: string, the text that shows on the subject line

message: string, the text of the message

attachment: string, a comma-delimited list of the attachments' file name and path to be sent as attachments

Returns:

0 – Success

<0 – Error code

The return code is numeric, where zero means success.

Example:

MailSend ('jenny@frigates.com', 'fred@aaawidgets.com', '', '', 'May Invoice', 'Attached is your May invoice', ‘F:\Invoices\aaa_11_2007.pdf’)

Note:

  • To display the name of the sender and not the email address, use the following syntax for the from parameter: 'name to display <email address>'

  • If the return code is not zero, you can use the return code as a parameter to the MailError function to show a user-friendly error message. If the return code is in the BP variable, then:
    'Send return code: '&Str (BP,'5NC')&' '&MailError (BP)

    will give a structured message with the error code number and message.

  • You can set the character set required by adding the following line to the [MAGIC_ENV] section in the Magic.ini file:
    MailCharset =

See also:

Mail functions

MailCharset

The Online and Rich Client Samples projects (program EL01, EL02, REL01and REL02)

Reference
Attachment 
Attachment