email (function)

Last updated: Tue, Jan 10, 2023 9:52 pm
Return to Knowledgebase

Purpose

Send an email if properly configured

Location

users/helpers/helpers.php

Parameters

# Parameter Data Type Required Description
1 $to Yes undocumented
2 $subject Yes undocumented
3 $body Yes undocumented
4 $opts = [] Yes undocumented
5 $attachment = null Yes undocumented

Example

email(\"bob@aol.com\",\"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.
Options:
You can also pass

$opts = array(
\'email\' => \'from_email@aol.com\',
\'name\'  => \'Bob Smith\'
);


Which would be formatted as:
email(\"bob@aol.com\",\"Hi Bob\",\"This is an email\",$opts);

Attachments are also possible by doing

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