title: How to configure MAILER_URL in .env file of Symfony 4 to send e-mails via sendmail with Swift_Mailer?
body: <p>I am working on a Symfony 4 app using <code>Swift_Mailer</code> to send e-mails with.
  Since there is no possibility in my case to use SMTP (don't ask why…) I have to use something like <code>sendmail</code>.</p>
  
  <p>By default the config of Swift Mailer is done in Symfony's <code>.env</code> file in URL notation in an option named <code>MAILER_URL</code>. The default value is "<code>null://localhost</code>" which doesn't send mails at all.</p>
  
  <p>All I could find for what the value has to be is an example for Gmail or for SMTP in general as documented in the <a href="https://symfony.com/doc/current/email.html" rel="noreferrer">Symfony docs</a> as well as in the sample .env as generated by Composer.</p>
  
  <p>Default content of .env:</p>
  
  <pre><code># …
  
  ###&gt; symfony/swiftmailer-bundle ###
  # For Gmail as a transport, use: "gmail://username:password@localhost"
  # For a generic SMTP server, use: "smtp://localhost:25?encryption=&amp;auth_mode="
  # Delivery is disabled by default via "null://localhost"
  MAILER_URL=null://localhost
  ###&lt; symfony/swiftmailer-bundle ###
  
  # …
  </code></pre>
  
  <p>What I don't know and therefore what my question is:</p>
  
  <p><strong>What do I need to do to make <code>sendmail</code> work with this?</strong></p>
  
  <p>I already tried something like:</p>
  
  <pre><code>MAILER_URL=sendmail://localhost
  </code></pre>
  
  <p>and</p>
  
  <pre><code>MAILER_URL=sendmail://my-domain.com
  </code></pre>
  
  <p>but without success so far.</p>
  
  <p>When using the console command</p>
  
  <pre><code>bin/console swiftmailer:email:send
  </code></pre>
  
  <p>I even get an "[OK] 1 emails were successfully sent." as result, but in fact no e-mail is sent.<br>
  (… No spooling, by the way. <code>bin/console swiftmailer:spool:send</code> returns "0 emails sent".)
  Mail delivery seems to be interupted or so, since the mails won't arraive at my mail account, also my SPAM is empty.</p>
  
  <p>Directly invoking the <code>sendmail</code> command on the other hand does work. (My test mails arrive at my SPAM though, but still: The mails are sent.)</p>
  
  <p><strong>Again, how do I have to configure the <code>MAILER_URL</code> for <code>Swift_Mailer</code> in my <code>.env</code> in Symfony 4 to use <code>sendmail</code>?</strong></p>
  
  <p>Is it possible at all?</p>