I don’t think this is an MvcMailer question (this is the email program I use), but I am struggling with creating a Googleplex search to figure out how to send emails from different accounts based on my context.
I need to send two email messages from two different email accounts. I tried using
mailMessage.From = new MailAddress(" some-other-email@gmail.com ");
in MvcMailer, but it doesn't even appear in the email inbox in the temp directory. It displays as what is in the web.config file: " some-email@gmail.com ".
This is my web.config for MvcMailer:
<mailSettings> <smtp from=" some-email@gmail.com " deliveryMethod="SpecifiedPickupDirectory"> <network host="localhost" /> <specifiedPickupDirectory pickupDirectoryLocation="c:\temp\" /> </smtp> </mailSettings>
This is the mailer 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 ");
Again, the above code works to send email. I just don’t know how to configure the mailbox to be sent from the specified email address, and not just from " some-email@gmail.com ", as in web.config. I have several MailMessages, and you need to send specific messages from another email account.
I would really appreciate any help / code examples.
source share