phpmailerHow do I configure PHPMailer to use TLS 1.2?
- Download and install PHPMailer.
- Create a
PHPMailerinstance and set theSMTPSecureproperty to'tls':
$mail = new PHPMailer;
$mail->SMTPSecure = 'tls';
- Set the
SMTPAutoTLSproperty totrueto enable TLS 1.2:
$mail->SMTPAutoTLS = true;
- Set the
Hostproperty to the SMTP hostname and port of your email provider:
$mail->Host = 'smtp.example.com:587';
- Set the
SMTPAuthproperty totrueif your email provider requires authentication:
$mail->SMTPAuth = true;
- Set the
UsernameandPasswordproperties if authentication is required:
$mail->Username = 'username';
$mail->Password = 'password';
- Send the email using the
send()method.
Helpful links
More of Phpmailer
- How can I configure PHPMailer to support Polish characters?
- How can I set up PHPMailer to use Zimbra SMTP?
- How can I configure PHPMailer to work with GoDaddy?
- How to use PHPMailer with PHP 7.4?
- How do I use PHPMailer to attach a ZIP file?
- How can I resolve the issue of my PHPmailer username and password not being accepted?
- How do I use PHPMailer to encode emails in UTF-8?
- How can I use PHPMailer to create an HTML body for my emails?
- How do I configure PHPmailer to use Zoho SMTP?
- How can I use PHPMailer without SMTP secure?
See more codes...