phpmailerHow do I get the message ID of a sent email using PHPMailer?
To get the message ID of a sent email using PHPMailer, you can use the getLastMessageID()
method. This method returns the message ID of the most recently sent email.
Example code
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
// your code to send email
echo $mail->getLastMessageID();
Output example
<[email protected]>
This code does the following:
- Includes the PHPMailerAutoload file.
- Instantiates a new PHPMailer object.
- Sends the email.
- Echoes the message ID of the most recently sent email.
Helpful links
More of Phpmailer
- How can I configure PHPMailer to support Polish characters?
- How do I configure the timeout settings for PHPMailer?
- How do I use PHPMailer to send a file?
- How can I use PHPMailer without SMTP secure?
- How do I use PHPMailer to attach a ZIP file?
- How do I determine which version of PHPMailer I'm using?
- How can I configure PHPMailer to ignore TLS certificate errors?
- How can I set up PHPMailer to use Zimbra SMTP?
- How can I use PHPMailer in Yii 1?
- How can I use PHPMailer to send emails with a Yahoo account?
See more codes...