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 do I use PHPMailer to attach a ZIP file?
- How do I use PHPMailer to send a file?
- How can I configure PHPMailer to support Polish characters?
- How can I send a UTF-8 encoded email using PHPMailer?
- How do I use PHPMailer to send emails through Namecheap?
- How can I set up PHPMailer to use Zimbra SMTP?
- How do I configure the timeout settings for PHPMailer?
- How can I use PHPMailer to prevent junk mail?
- How to use PHPMailer with PHP 7.4?
- How do I configure PHPmailer to use Zoho SMTP?
See more codes...