MvcMailer icon indicating copy to clipboard operation
MvcMailer copied to clipboard

MVC Mailer with Gmail, From address and name is "me" instead of what is populated from form submission

Open theericharms opened this issue 9 years ago • 0 comments

Hi, Using mvcmailer to send emails for a form submission, and we set the From to be the name and email that was gathered in the form. We use an email account (ie: [email protected]) which is used as the email account to send us the form data. The email is sent to that same account.

All was working on our Arvixe mail server, but my client switched to Gmail for Business, and now when it comes into our Gmail inbox, the message is from "me", and has our name and our email address that we use to send the form data. Ive been trying to sort this out with Google support but they dont seem to know how to fix it.

Has anyone witnessed this before? heres an example of how we set the From parameter.

public virtual MvcMailMessage ContactUs(Contact contact) { ViewData["contactForm"] = contact;

        Debug.WriteLine(contact);

        return Populate(x =>
        {
            x.Subject = "Contact Form";
            x.ViewName = "ContactUs";
            x.To.Add(new MailAddress(ConfigurationManager.AppSettings["Email"]));
            x.Bcc.Add(new MailAddress(ConfigurationManager.AppSettings["BCCEmail"]));
            x.From = (new MailAddress(contact.Email, displayName: contact.Email));
            x.IsBodyHtml = true;
        });
    }

Thanks!

theericharms avatar Jun 16 '15 17:06 theericharms