FrostMVC\Mail
use FrostMVC\Mail;
SMTP email sender built on PHPMailer.
Wraps PHPMailer with a simpler configuration API while preserving access to the underlying PHPMailer instance via getMail().
| ->__construct() | — |
| ->addAttachment() | Adds an attachment from a file path. |
| ->addBCC() | Adds a BCC recipient. |
| ->addCC() | Adds a CC recipient. |
| ->addRecipient() | Adds a recipient email address. |
| ->addReplyTo() | Adds a Reply-To address. |
| ->getException() | Returns whether exceptions are thrown on send failure. |
| ->getHost() | — |
| ->getMail() | Returns the underlying PHPMailer instance for advanced configuration. |
| ->getPassword() | — |
| ->getPort() | — |
| ->getSecurity() | — |
| ->getSMTPAuth() | Returns whether SMTP authentication is enabled. |
| ->getUsername() | — |
| ->send() | Sends the email using the configured SMTP settings. Debug output, when enabled, is written to the smtp.error log via Logs::write(). |
| ->setBody() | — |
| ->setDebug() | Sets the SMTP debug output level. Common values: SMTP::DEBUG_OFF (0), SMTP::DEBUG_CLIENT (1), SMTP::DEBUG_SERVER (2). |
| ->setException() | Controls whether PHPMailer throws exceptions on errors. |
| ->setHost() | — |
| ->setPassword() | — |
| ->setPort() | — |
| ->setSecurity() | Sets the encryption type. |
| ->setSenderName() | — |
| ->setSMTPAuth() | Enables or disables SMTP authentication. |
| ->setSMTPAutoTLS() | Enables or disables automatic TLS detection. Setting this to false prevents PHPMailer from upgrading to TLS when not required. |
| ->setSubject() | — |
| ->setUsername() | — |
$mail->__construct(bool $exception = false)
No description yet.
| $exception | bool |
Default: false |
$mail->addAttachment($path, $name = '', $encoding = PHPMailer\PHPMailer\PHPMailer::ENCODING_BASE64, $type = '', $disposition = 'attachment')
Adds an attachment from a file path.
| $path | string |
Absolute path to the file. |
| $name | string |
Attachment filename shown to the recipient. Default:'' |
| $encoding | string |
Content transfer encoding. Default:PHPMailer\PHPMailer\PHPMailer::ENCODING_BASE64 |
| $type | string |
MIME type. Default:'' |
| $disposition | string |
'attachment' or 'inline'. Default:'attachment' |
$mail->addBCC($email, $name = '')
Adds a BCC recipient.
string |
||
| $name | string |
Optional display name. Default:'' |
$mail->addCC($email, $name = '')
Adds a CC recipient.
string |
||
| $name | string |
Optional display name. Default:'' |
$mail->addRecipient($email, $name = '')
Adds a recipient email address.
string |
||
| $name | string |
Optional display name. Default:'' |
$mail->addReplyTo($email, $name = '')
Adds a Reply-To address.
string |
||
| $name | string |
Optional display name. Default:'' |
$mail->getException()
Returns whether exceptions are thrown on send failure.
bool
$mail->getHost()
No description yet.
string SMTP hostname.
$mail->getMail()
Returns the underlying PHPMailer instance for advanced configuration.
PHPMailer
$mail->getPassword()
No description yet.
string SMTP password.
$mail->getPort()
No description yet.
int SMTP port number.
$mail->getSecurity()
No description yet.
string Encryption type: PHPMailer::ENCRYPTION_STARTTLS or PHPMailer::ENCRYPTION_SMTPS.
$mail->getSMTPAuth()
Returns whether SMTP authentication is enabled.
bool
$mail->getUsername()
No description yet.
string SMTP username.
$mail->send($showError = false)
Sends the email using the configured SMTP settings. Debug output, when enabled, is written to the smtp.error log via Logs::write().
| $showError | int|false |
SMTP debug level to enable during the send, or false to suppress. Default:false |
bool True on success, false on failure.
$mail->setBody($message)
No description yet.
| $message | string |
HTML email body. |
$mail->setDebug($debug = PHPMailer\PHPMailer\SMTP::DEBUG_SERVER)
Sets the SMTP debug output level. Common values: SMTP::DEBUG_OFF (0), SMTP::DEBUG_CLIENT (1), SMTP::DEBUG_SERVER (2).
| $debug | int |
Default: PHPMailer\PHPMailer\SMTP::DEBUG_SERVER |
$mail->setException($exception)
Controls whether PHPMailer throws exceptions on errors.
| $exception | bool |
$mail->setHost($host)
No description yet.
| $host | string |
SMTP server hostname. |
$mail->setPassword($password)
No description yet.
| $password | string |
SMTP authentication password. |
$mail->setPort($port)
No description yet.
| $port | int |
SMTP port (typically 465 for SMTPS, 587 for STARTTLS). |
$mail->setSecurity($security)
Sets the encryption type.
| $security | string |
PHPMailer::ENCRYPTION_STARTTLS or PHPMailer::ENCRYPTION_SMTPS. |
$mail->setSenderName($name)
No description yet.
| $name | string |
Display name of the sender. |
$mail->setSMTPAuth($bool)
Enables or disables SMTP authentication.
| $bool | bool |
$mail->setSMTPAutoTLS($bool)
Enables or disables automatic TLS detection. Setting this to false prevents PHPMailer from upgrading to TLS when not required.
| $bool | bool |
$mail->setSubject($subject)
No description yet.
| $subject | string |
Email subject line. |
$mail->setUsername($username)
No description yet.
| $username | string |
SMTP authentication username (usually the sender address). |
Generated from core/classes/Mail.php (FrostMVC ).