title: Symfony Mailer Exchange mail server
body: <p>Today I'm trying to connect my Symfony application to a local mail server that running as Microsoft Exchange server.</p>
  <p>First, before switching to Symfony my web project was developed with Asp.NET, for some personal reasons I refund the project under Symfony.</p>
  <p>In C# this code was working correctly :</p>
  <pre><code>public static void MailSender(string server, string fromDisplayName, string fromMailAddress, List&lt;List&lt;KeyValuePair&lt;string,string&gt;&gt;&gt; tos, string subject, string body, List&lt;string&gt; attachments = null, List&lt;List&lt;KeyValuePair&lt;string,string&gt;&gt;&gt; ccs = null, List&lt;List&lt;KeyValuePair&lt;string,string&gt;&gt;&gt; bccs = null)
      {
          using (MailMessage mailMessage = new MailMessage())
          {
              mailMessage.From = new MailAddress(fromMailAddress, fromDisplayName);
              foreach(List&lt;KeyValuePair&lt;string, string&gt;&gt; to in tos){
                  mailMessage.To.Add(new MailAddress(to[1].Value.ToString(), to[0].Value.ToString()));
              }
              if (ccs != null){
                  foreach(List&lt;KeyValuePair&lt;string, string&gt;&gt; cc in ccs){
                      mailMessage.CC.Add(new MailAddress(cc[1].Value.ToString(), cc[0].Value.ToString()));
                  }
              }
              if (bccs != null){
                  foreach(List&lt;KeyValuePair&lt;string, string&gt;&gt; bcc in bccs){
                      mailMessage.CC.Add(new MailAddress(bcc[1].Value.ToString(), bcc[0].Value.ToString()));
                  }
              }
              mailMessage.Subject = subject;
              mailMessage.Body = body;
              mailMessage.IsBodyHtml = true;
              if (attachments != null)
              {
                  foreach (string attachment in attachments)
                      mailMessage.Attachments.Add(new Attachment(attachment));
              }
  
              using (SmtpClient smtpClient = new SmtpClient(server))
              {
                  smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
                  smtpClient.UseDefaultCredentials = true;
                  smtpClient.Send(mailMessage);
              }
          }
      }
  </code></pre>
  <p>The server url was in the format: <code>myserver.domain.tld</code>.
  Also it used the Windows Integrated Authentication.</p>
  <p>How can I configure PHP or Symfony (or both) to work with my local Exchange mail server ?</p>
  <p>I tried to use this type of url in <code>MAILER_DSN</code> variable:
  <code>smtp://user:pass@myserver.domain.tld</code> (user as email address with '%40' for '@' character.</p>
  <p>Thanks.</p>