Provides an API interface to email and WireMail.
// Simple usage example
$message = $mail->new();
$message->subject('Hello world')
->to('user@domain.com')
->from('you@company.com')
->body('Hello there big world')
->bodyHTML('<h2>Hello there big world</h2>');
$numSent = $message->send();
// ProcessWire 3.0.113 lets you skip the $mail->new() call if you want:
$numSent = $mail->subject('Hello world')
->to('user@domain.com')
->from('you@company.com')
->body('Hello there big world')
->bodyHTML('<h2>Hello there big world</h2>')
->send();
Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the WireMailTools
class also inherits all the methods and properties of: Wire.
Common
Name | Return | Summary | |
---|
$mail->from() $mail->from(string $email) $mail->from(string $email, $name = null) | WireMail | Return new WireMail instance populated with “from” email | |
$mail->isBlacklistEmail() $mail->isBlacklistEmail(string $email) $mail->isBlacklistEmail(string $email, array $options = []) | bool string | Is given email address in the blacklist? | |
$mail->mail() $mail->mail($to, string $subject, $message) $mail->mail($to, string $subject, $message, array $headers = []) | bool | Send an email, drop-in replacement for PHP mail() that uses the same arguments | |
$mail->mailHTML() $mail->mailHTML($to, string $subject, $messageHTML) $mail->mailHTML($to, string $subject, $messageHTML, array $headers = []) | bool | Send an email with message assumed to be in HTML | |
$mail->new() $mail->new() $mail->new($options = []) | WireMail | Get a new WireMail instance for sending email | |
$mail->send() $mail->send() $mail->send($to = '', string $from = '', string $subject = '', $body = '', $options = []) | int WireMail | Send an email | |
$mail->sendHTML() $mail->sendHTML() $mail->sendHTML($to = '', string $from = '', string $subject = '', string $bodyHTML = '', $options = []) | int WireMail | Send an email with given message text assumed to be HTML | |
$mail->subject() $mail->subject(string $subject) $mail->subject(string $subject) | WireMail | Return new WireMail instance populated with subject | |
$mail->to() $mail->to($email) $mail->to($email, string $name = null) | WireMail | Return new WireMail instance populated with “to” email | |
Additional methods and properties
In addition to the methods and properties above, WireMailTools also inherits the methods and properties of these classes:
API reference based on ProcessWire core version 3.0.236