$mail smtpdebug

A classic!

$mail = smtpdebug is a PHP script that allows you to debug SMTP (Simple Mail Transfer Protocol) issues. It's a simple script that sends an email using the mail() function and then outputs the SMTP debug information to the screen.

Here's a breakdown of what the script does:

  1. It sets up an SMTP connection using the mail() function.
  2. It sends an email using the mail() function.
  3. It outputs the SMTP debug information to the screen, including:
    • The SMTP server response codes (e.g., 250, 550, etc.).
    • The SMTP server's response messages (e.g., "Message accepted for delivery").
    • The email headers and body.

The script is useful for troubleshooting SMTP issues, such as:

Here's an example of what the output might look like:

SMTP Debug Information:

SMTP Server: mail.example.com
SMTP Port: 25
SMTP Authentication: username:john, password:password

SMTP Response Codes:
250 2.1.5 Message accepted for delivery
250 2.1.5 Message accepted for delivery

Email Headers:
From: John Doe <[email protected]>
To: Jane Doe <[email protected]>
Subject: Test Email

Email Body:
This is a test email.

SMTP Debug Information:
SMTP connection established.
SMTP authentication successful.
Email sent successfully.

Note that the output will vary depending on the specific SMTP server and configuration.