email (function)

Last updated: Fri, Jun 2, 2023 5:51 am
Return to Knowledgebase


Send an email if properly configured




# Parameter Data Type Required Description
1 $to string | array Yes The recipient(s) of the email. Can be a single email address or an array of email addresses.
2 $subject string Yes The subject of the email.
3 $body string Yes The body/content of the email.
4 $opts = [] array No Additional options (see below)
5 $attachment = null string | null No The path to the file attachment.


Data Type Description of Returned Data
bool Returns true if sent. If debug mode is active, returns diagnostic info as to why the send failed.


email(\"\",\"Hi Bob\",\"This is an email\");

Further Documentation:

Note: Email settings must be properly configured and tested in the Email Settings section of the dashboard.
You can also passoptions in this format

$opts = array(
\'email\' => \'\',
\'name\'  => \'Bob Smith\'

The full list of options are:
Additional options for the email (optional). Possible options include:
- email: The email address to send the email from.
- name: The name associated with the sender's email address.
- cc: The email address(es) to CC (carbon copy).
- bcc: The email address(es) to BCC (blind carbon copy).

email(\"\",\"Hi Bob\",\"This is an email\",$opts);

Attachments are also possible by doing

$attachment = \"welcome.pdf\";
email(\"\",\"Hi Bob\",\"This is an email\",$opts,$attachment);