phpmailerHow can I configure PHPMailer to ignore TLS certificate errors?
PHPMailer can be configured to ignore TLS certificate errors by setting the SMTPOptions property to an array containing the ssl key and the verify_peer and verify_peer_name keys set to false as shown in the following example:
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false
)
);
The above code will configure PHPMailer to ignore TLS certificate errors.
Code explanation
$mail->SMTPOptions- The property used to configure PHPMailer to ignore TLS certificate errors.ssl- The key inside theSMTPOptionsarray that contains the settings for ignoring TLS certificate errors.verify_peer- The key inside thesslarray that must be set tofalseto ignore TLS certificate errors.verify_peer_name- The key inside thesslarray that must be set tofalseto ignore TLS certificate errors.
Helpful links
More of Phpmailer
- How can I configure PHPMailer to support Polish characters?
- How do I use PHPMailer to attach a ZIP file?
- How do I configure the timeout settings for PHPMailer?
- How do I view the log for my PHPMailer emails?
- How can I use PHPMailer to send emails with a Yahoo account?
- How do I enable debug mode in PHPMailer?
- How do I set the from name when using PHPMailer?
- How can I set up PHPMailer to use Zimbra SMTP?
- How can I use PHPMailer to send emails through Yandex?
- How can I send a UTF-8 encoded email using PHPMailer?
See more codes...