0
I was wondering if there is any way to send emails to other inboxes, for example gmail
At the moment my code for sending emails is this:
using (var smtpClient = new SmtpClient(WebConfigurationManager.AppSettings["smtpHost"], 587))
{
smtpClient.Credentials = new NetworkCredential(WebConfigurationManager.AppSettings["smtpClient"],
WebConfigurationManager.AppSettings["smtpClientPassword"]);
smtpClient.EnableSsl = true;
smtpClient.SendCompleted += (s, e) =>
{
smtpClient.Dispose();
((MailMessage)e.UserState).Dispose();
};
await smtpClient.SendMailAsync(model.GetMessage());
}
Is there any class, property in the client, anything I can do to achieve this goal?
Is the goal to send an email to a gmail account? If so, then it is to use that code you have, changing the recipient in the object of the message. ps: you’re doing it in MVC, right?
– Renato Afonso
@Renatoafonso The goal is : Instead of sending to inbox, send to Updates, or any other.
– Lucas
By code, I think it has no form. You need to set up in your own email box a rule to redirect emails with a certain format to that specific area.
– Renato Afonso
@Renatoafonso have any idea how to do this?
– Lucas
If it’s gmail, just go to the settings, and you have a filter and address option there, click to create a new filter, set the rules by which you want to capture the type of email you want, and then set the action (where you want to send that email)
– Renato Afonso