I am creating a gmail SMTP client like so:
client = new SmtpClient();
client.UseDefaultCredentials = false;
client.Host = "smtp.gmail.com";
client.Port = 587;
client.EnableSsl = true;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Credentials = new NetworkCredential(email, password);
client.Timeout = 20000;
And sending an email like so:
MailMessage msg = new MailMessage();
msg.From = new MailAddress([email protected]);
msg.To.Add(to);
msg.Subject = subject;
msg.Body = body;
client.Send(msg);
I wish that if someone replies to my email it'll go to the admins email address, not to my application, and also ideally for them not to even know about the existence of the application's email address.
I could have my application forward emails received to the admin, but that's an ugly solution.
I understood from other threads that there's no way to send an email with a "reply to" field.
What I'm wondering is what if I have the admin's email as a "Send mail as" registered account on the application's GMail account.
So through the GMail interface I can send an email as if I'm the admin, can I do this from my c# application?
I know that I can set the from field of the msg sent to the admin's email, but I'm wondering if this is the correct approach, if gmail supports this, and if the email doesn't have more likelihood of ending up in the spam folder.