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 do I use PHPMailer to attach a ZIP file?
- How can I configure PHPMailer to support Polish characters?
- How to use PHPMailer with PHP 7.4?
- How do I determine which version of PHPMailer I'm using?
- How can I set up PHPMailer to use Zimbra SMTP?
- How do I configure PHPmailer to use Zoho SMTP?
- How can I configure PHPMailer to work with GoDaddy?
- How do I update PHPMailer?
- How do I use PHPMailer with IMAP?
- How can I use PHPMailer in Yii 1?
See more codes...