Search code examples
phpemailphpmailer

PHPMailer - How to check if mail is sent encrypted via TLS?


when using PHPMailer and sending mails over port 587 with following settings activated: $mail->SMTPAuth = true; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;

sent mails do not have "TLS" or "SSL" in the mail header. Is it possible that the mail is still sent encrypted or is the missing "TLS"/"SSL" pointing to no encryption?

Thank you!


Solution

  • This is more a mailserver question, because SMTP is used between servers. The security protocol is negotiated between the sending and receiving server.

    It is unlikely you'll find "TLS" or "SSL" in the mail headers. You could look for the word "with" followed by one of these keywords: ESMTPA, ESMTPS, ESMTPSA, LMTP, LMTPA, LMTPS, and LMTPSA.

    The keyword "ESMTPS" indicates the use of ESMTP when STARTTLS is successfully negotiated to provide a strong transport encryption layer.

    For background information see: rfc3848