title: How set up different stmpclient instances in web.config?
body: <p>I don't believe this is specifically an MvcMailer question (this is the mailer I am using), but I am struggling with framing a Googleplex search to figure out how to send e-mails from different accounts based on my context.</p>
  
  <p>I have a need to send two e-mails from two different e-mail accounts. I have tried using</p>
  
  <pre><code>mailMessage.From = new MailAddress("some-other-email@gmail.com");
  </code></pre>
  
  <p>in MvcMailer, but that doesn't even show up in the e-mail I dump to the temp directory. It shows up as what is in the web.config: "some-email@gmail.com".</p>
  
  <p>This is my web.config for MvcMailer:</p>
  
  <pre><code>&lt;mailSettings&gt;
        &lt;!-- Method#1: Configure smtp server credentials --&gt;
        &lt;!--&lt;smtp from="some-email@gmail.com"&gt;
          &lt;network enableSsl="true" host="smtp.gmail.com" port="587" userName="some-email@gmail.com" password="valid-password" /&gt;
        &lt;/smtp&gt;--&gt;
        &lt;!-- Method#2: Dump emails to a local directory --&gt;
  
              &lt;smtp from="some-email@gmail.com" deliveryMethod="SpecifiedPickupDirectory"&gt;
                  &lt;network host="localhost" /&gt;
                  &lt;specifiedPickupDirectory pickupDirectoryLocation="c:\temp\" /&gt;
              &lt;/smtp&gt;
  
      &lt;/mailSettings&gt;
  </code></pre>
  
  <p>This is the mailer code:</p>
  
  <pre><code>public virtual MailMessage EMailConsultation(EMailConsultationData model)
          {
              var mailMessage = new MailMessage { Subject = "INQUIRY: E-Mail Consultation" };
  
              mailMessage.From = new MailAddress("some-other-email@gmail.com");//I tested this to see if at the very least it would show up in the e-mail, but it didn't.
  
              mailMessage.To.Add(model.EMail);
  
              ViewData = new ViewDataDictionary(model);
              PopulateBody(mailMessage, viewName: "InquiryEMailConsultation");
  
              return mailMessage;
          }
  </code></pre>
  
  <p>Again, the above code works to send e-mail. I just do not know how I can set up the mailer to send from a specified e-mail address, rather than just from "some-email@gmail.com" as is in the web.config. I have multiple MailMessages, and have a need to send certain ones from a different e-mail account.</p>
  
  <p>I would greatly appreciate any help/code examples.</p>