Symfony: How to catch mail delivery issues

When using the mail delivery system built into Symfony, you can track if the message failed when being handed off to the SMTP server through a try/catch block as showing at https://symfony.com/doc/current/mailer.html#handling-sending-failures


$email = new Email();
// ...
try {
    $mailer->send($email);
} catch (TransportExceptionInterface $e) {
    // some error prevented the email sending; display an
    // error message or try to resend the message
}

However, if you’re looking for further feedback, such as if the message was ultimately undeliverable (bounce, full mailbox, etc) then you’ll want to look either into the management side of your mail server, or more into third-party transports, that will then issue a callback webhook that will later inform you of the status. Those service also provide great feedback such as if your message was marked spam by the recipient, etc.