phpmailerHow do I configure PHPMailer to use TLS 1.2?
- Download and install PHPMailer.
- Create a
PHPMailer
instance and set theSMTPSecure
property to'tls'
:
$mail = new PHPMailer;
$mail->SMTPSecure = 'tls';
- Set the
SMTPAutoTLS
property totrue
to enable TLS 1.2:
$mail->SMTPAutoTLS = true;
- Set the
Host
property to the SMTP hostname and port of your email provider:
$mail->Host = 'smtp.example.com:587';
- Set the
SMTPAuth
property totrue
if your email provider requires authentication:
$mail->SMTPAuth = true;
- Set the
Username
andPassword
properties if authentication is required:
$mail->Username = 'username';
$mail->Password = 'password';
- Send the email using the
send()
method.
Helpful links
More of Phpmailer
- How to use PHPMailer with PHP 7.4?
- How can I configure PHPMailer to support Polish characters?
- How can I use PHPMailer without SMTP secure?
- How do I configure PHPMailer to work with Microsoft Exchange?
- How can I use PHPMailer with React?
- How can I configure PHPMailer to work with GoDaddy?
- How can I use PHPMailer to send emails with a Yahoo account?
- How can I use PHPMailer with XAMPP on Windows?
- How do I determine which version of PHPMailer I'm using?
- How do I set the X-Mailer header using PHPMailer?
See more codes...