Includes complete headers and body.
Only valid post preSend().
public getSentMIMEMessage ( ) : string | ||
return | string |
use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; $mail = new PHPMailer(true); // ... configure the PHPMailer instance ... // Send the email if (!$mail->send()) { echo 'Mailer Error: ' . $mail->ErrorInfo; } else { // Get the raw MIME message of the sent email $mimeMessage = $mail->getSentMIMEMessage(); // ... do something with the MIME message, such as save it to a database ... }In this example, we create a new PHPMailer instance and configure it with the necessary email parameters (e.g. recipients, subject, body, etc). We then call the send() method to send the email. If the send() method returns false, we output an error message. Otherwise, we call the getSentMIMEMessage() method to retrieve the raw MIME message of the sent email. We can then do something with this MIME message, such as save it to a database. The package name for PHPMailer is "phpmailer/phpmailer".
public getSentMIMEMessage ( ) : string | ||
return | string |