9951 explained code solutions for 126 technologies


phpmailerHow do I disable STARTTLS in PHPMailer?


To disable STARTTLS in PHPMailer, you need to set SMTPSecure to false and SMTPAutoTLS to false in your mailer configuration.

Example code

$mail = new PHPMailer;
$mail->SMTPSecure = false;
$mail->SMTPAutoTLS = false;

These two settings will disable the STARTTLS encryption in PHPMailer.

Code explanation

  • SMTPSecure - This setting is used to set the encryption type of the connection. Setting it to false will disable encryption.
  • SMTPAutoTLS - This setting is used to enable or disable TLS encryption automatically. Setting it to false will disable it.

Helpful links

Edit this code on GitHub