title: How to debug Symfony Mailer delivery problems?
body: <p>I am working on my first Symfony 5 project and struggle to send mail using the build in <code>MailerInterface</code>. I have worked with Swift Mailer in Symfony 3 before and never had similar issues before.</p>
  <pre><code>use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  use Symfony\Component\Mailer\MailerInterface;
  ...
  
  class SomeController extends AbstractController {
      public someAction(Request $request, MailerInterface $mailer) {
          ...
          $email = (new TemplatedEmail())
              -&gt;from(new Address('address@example.com', 'My Symfony Mail'))
              //-&gt;to($user-&gt;getEmail())
              -&gt;to('receiver@example.com')
              -&gt;subject('Subject')
              -&gt;htmlTemplate('email.html.twig');
      
          $mailer-&gt;send($email);
      }
  }
  
  
  // .env
  #MAILER_DSN=smtp://user:pass@smtp.example.com:25
  MAILER_DSN=sendmail://default
  </code></pre>
  <p>If <code>MAILER_DSN</code> has some malformed format an exception is thrown and shown on the Symfony debugger page, e.g. <code>The &quot;invaliddsn&quot; mailer DSN must contain a scheme</code>... Thus it seems that the configured DSN <code>smtp://user:pass@smtp.example.com:25</code> is correct. Using the same credentials, host and port in other mail applications is no problem.</p>
  <p>However, when using this code no error/exception is shown and I receive no mail at all. Of course I have double checked the logs (no errors), the receivers spam folder (nothing). Specifying an SMTP server or sendmail does not make any difference.</p>
  <p>The <a href="https://symfony.com/doc/current/mailer.html#transport-setup" rel="nofollow noreferrer">Symfony docs</a> only explain how to handle exceptions but in my case no exceptions are thrown.</p>
  <p>While there are a lot of other questions about mailing issues in Symfony, most of them deal with the older Swift Mailer or other, specific problems.</p>
  <p><strong>How can I figure out if a mail is send and not received or not send at all?</strong></p>