January 27, 2021
The Return-Path
header in an email defines which email address should receive bounces and complaints (such as getting marked as spam). It's useful to set this header so you can monitor how many complaints you're getting, and which emails are bouncing.
You can set this header in a Laravel Mailable using the withSwiftMessage()
method:
public function build()
{
$this->withSwiftMessage(function ($message) {
$message->getHeaders()
->addTextHeader('Return-Path', '[email protected]');
});
return $this
->view('some.view');
// the rest of the normal mailable methods for from, subject, etc
}
Now, this email will have the Return-Path
header defined, and receiving email clients will send a notification email to that address if the email bounces or is marked as spam.
Tufts Meal Plan Wrapped
Mar 2, 2024
Building an e-ink picture frame that displays an iCloud photo album
Jan 9, 2024
2023 in review
Jan 5, 2024
Subscribe to my newsletter for a monthly round-up of new blog posts and projects Iām working on!