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 to use PHPMailer with PHP 7.4?
- How can I configure PHPMailer to support Polish characters?
- How can I use PHPMailer without SMTP secure?
- How do I determine which version of PHPMailer I'm using?
- How do I use PHPMailer to embed an image in an email using Base64 encoding?
- 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 encode emails in UTF-8?
- How do I configure PHPMailer to use TLS 1.2?
- How can I use PHPMailer to send emails with a Yahoo account?
See more codes...