This functionality is new in version 14+
Basic Example:
$mail = FreePBX::Mail();
$mail->setBody("This is test");
$mail->setTo(array('user@example.com','user2@example.com'));
$mail->send(); |
Most of the "set" items have defaults and don't need to be called. You only need to setTo and either setBody OR setMultipart.
Methods
setFrom($email, $name);
$email = "sender@example.com";
$name = "Johnny Sender";
setTo(array($email1, $email2, $email....));
Pass an array of recipients. Note these will be sent to ALL recipients together, not as individual emails.
setPriority($int);
$int options are
1 Highest
2 High
3 Normal (default)
4 Low
5 Lowest
setSubject($subject);
Set the email Subject
Content
You have 2 options for content.
Text Only
setBody($messageText);
HTML + Text
setMultipart($text,$html);
Attachments
addAttachment($path);
$path can be a filesystem path or url.
Custom Headers
addHeader($header,$value);
Sending
send();