phpmailerHow do I enable debug mode in PHPMailer?
Debug mode in PHPMailer can be enabled by setting the SMTPDebug
property. This property is available on the PHPMailer
class and can be set to any of the following values:
0
: No debug output1
: Commands2
: Data and commands3
: As 2 plus connection status4
: Low-level data output
Example code
// Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
Output example
SERVER -> CLIENT: 220 smtp.example.com ESMTP Postfix
CLIENT -> SERVER: EHLO localhost
SERVER -> CLIENT: 250-smtp.example.com
SERVER -> CLIENT: 250-PIPELINING
SERVER -> CLIENT: 250-SIZE 10240000
SERVER -> CLIENT: 250-VRFY
SERVER -> CLIENT: 250-ETRN
SERVER -> CLIENT: 250-STARTTLS
SERVER -> CLIENT: 250-ENHANCEDSTATUSCODES
SERVER -> CLIENT: 250-8BITMIME
SERVER -> CLIENT: 250 DSN
Helpful links
More of Phpmailer
- How can I configure PHPMailer to support Polish characters?
- How do I determine which version of PHPMailer I'm using?
- How can I use PHPMailer without SMTP secure?
- How can I configure PHPMailer to work with GoDaddy?
- How do I set the X-Mailer header using PHPMailer?
- How do I use PHPMailer to attach a ZIP file?
- How can I set up PHPMailer to use Zimbra SMTP?
- How can I configure PHPMailer to ignore TLS certificate errors?
- How can I use PHPMailer in Yii 1?
- How do I use PHPMailer to send emails through Namecheap?
See more codes...