Choose your database:
AnySQL
MySQL
MS SQL Server
PostgreSQL
SQLite
Firebird
Oracle
SQL Anywhere
DB2
MaxDB

Subscribe to our news:
Partners

ASA PHP Generator online Help

Prev Return to chapter overview Next

sendMailMessage

Sends an email message to specified recipients using project-level outgoing mail settings.

 

Signature:

function sendMailMessage($recipients, $messageSubject, $messageBody, 

       $attachments = '', $cc = '', $bcc = '')

 

Parameters:

Name

Data type

Description

Mandatory

$recipients

string or array

A recipient or a list of recipients for the email message

yes

$messageSubject

string

A subject of the email message

yes

$messageBody

string

A body of the email message. HTML is allowed.

yes

$attachments

string or array

An attachment or a list of attachments for the email message

no

$cc

string or array

A recipient or a list of recipients specified in the CC field

no

$bcc

string or array

A recipient or a list of recipients specified in the BCC field

no

 

Example 1

This example demonstrates the simplest use of the function.

 

sendMailMessage('recipient@example.com', 'Message subject', 'Message body');

 

Example 2

This example demonstrates an advanced use of the function.

 

$messageSubject = 'Welcome!!!';

$messageBody = file_get_contents("external_data/mail_message_body.html");

    

$attachments = 

    array(

        'external_data/files/example.pdf',

        'external_data/images/example.png'

    );

$cc = array('mark_lynch@example.com', 'david_frost@example.gov'); 

$bcc = 

    array(

        'dougie_jones@example.edu' => 'Dougie Jones',

        'bob_cooper@example.com' => 'Bob Cooper',        

        'laura_horne@example.en' => 'Laura Horne'        

    );

        

sendMailMessage('admin@example.com', $messageSubject, $messageBody, $attachments, $cc, $bcc);

 

See also: Setting up common SMTP servers.



Prev Return to chapter overview Next