phpmailerHow do I view the log for my PHPMailer emails?
To view the log for PHPMailer emails, you can use the $mail->SMTPDebug
property. This property can be set to one of four values: 0 (no output), 1 (errors and messages), 2 (messages only), or 3 (verbose debug output).
For example, to view verbose debug output, you can use the following code:
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->SMTPDebug = 3;
// other settings
$mail->send();
echo "Message sent!";
?>
This will output something like the following:
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
The $mail->SMTPDebug
property is set to 3
by default. It can be set to any of the four values before the $mail->send()
method is called.
Helpful links
More of Phpmailer
- How can I use PHPMailer with React?
- How can I configure PHPMailer to work with GoDaddy?
- 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 support Polish characters?
- How can I use PHPMailer to send emails from my WordPress site?
- How can I use PHPMailer in Yii 1?
- How do I use PHPMailer with IMAP?
- How do I check which version of PHPMailer I'm using?
See more codes...