How can one verify if emails sent to gmx.de are encrypted when using PHPMailer with TLS enabled?

To verify if emails sent to gmx.de are encrypted when using PHPMailer with TLS enabled, you can check the connection details in the debug output of PHPMailer. Look for the line "SERVER -> CLIENT: 220 TLS go ahead" which indicates that the server is ready to start TLS encryption. If this line is present, then the email communication is encrypted.

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

$mail = new PHPMailer(true);

$mail->isSMTP();
$mail->Host = 'smtp.gmx.de';
$mail->SMTPAuth = true;
$mail->Username = 'your_email@gmx.de';
$mail->Password = 'your_password';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;

// Enable verbose debug output
$mail->SMTPDebug = SMTP::DEBUG_SERVER;

try {
    $mail->setFrom('your_email@gmx.de', 'Your Name');
    $mail->addAddress('recipient@example.com', 'Recipient Name');
    $mail->Subject = 'Testing PHPMailer with TLS encryption';
    $mail->Body = 'This is a test email sent with PHPMailer using TLS encryption.';

    $mail->send();
    echo 'Email sent successfully!';
} catch (Exception $e) {
    echo "Email could not be sent. Mailer Error: {$mail->ErrorInfo}";
}