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 theSMTPOptions
array that contains the settings for ignoring TLS certificate errors.verify_peer
- The key inside thessl
array that must be set tofalse
to ignore TLS certificate errors.verify_peer_name
- The key inside thessl
array that must be set tofalse
to ignore TLS certificate errors.
Helpful links
More of Phpmailer
- How do I configure PHPMailer to use TLS 1.2?
- How do I check which version of PHPMailer I'm using?
- How do I configure PHPmailer to use Zoho SMTP?
- How can I use PHPMailer with XAMPP on a localhost?
- How do I set the X-Mailer header using PHPMailer?
- How can I use PHPMailer without SMTP secure?
- How can I use PHPMailer to validate email addresses?
- How do I use PHPMailer to send an HTML email with UTF-8 encoding?
- How can I send a UTF-8 encoded email using PHPMailer?
- How can I resolve the issue of my PHPmailer username and password not being accepted?
See more codes...