title: WCF Service - queue & batch messages (sending emails via SMTP)
body: <p>I have a WCF Service working via named pipes that is receiving data from ASP.NET MVC application: </p>
  
  <pre><code>[ServiceContract]
  public interface IEmailProcessor
  {
      [OperationContract(AsyncPattern = true)]
      void SendEmails(string subject, string body, string from, string to);
  }
  </code></pre>
  
  <p>Service gets subject, body, sender and recipients of an email. Then it puts an email together and send via SMTP.</p>
  
  <p>Client (MVC applicataion) is sending several emails at once, so I would like the service itself to work asynchronously (client just invokes <code>SendEmails</code> method few times and then the WCF Server takes care of the rest). But my email server sometimes refuses to send email because of greylisting of new email addresses. That's why I would like the WCF Server to also queue those email and try to send them one by one (retry few times if the error occurs).</p>
  
  <p>I've read several topics on WCF async nad MSMQ methods, but what is the best approach in my situation? Should I create two WCF Services (client-server &amp; server-server)? Or maybe use multi-threading? It's also important for me to not use any built-in SMTP solution because I would like to expand my Service to handle other messages not only emails.</p>