Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

smtp virtual server question

$
0
0

Hello,

I have an asp.net core web app, It is working on the IIS 8 windows server 2012. I need to send an e-mail to one of the action controllers. I installed the SMTP server. Did some googling and made configuration. I tried to send from one of my Gmail accounts. But I got "Delivery to the following recipients failed." error. Anyone who accomplished sending e-mail can help me, please?

Here is the sending e-mail in the controller:

public void sendMail(string body, string email)
        {
            SmtpClient client = new SmtpClient(server IP here);
            client.UseDefaultCredentials = false;
            client.Credentials = new NetworkCredential("myaccount@gmail.com", "my password");

            MailMessage mailMessage = new MailMessage();
            mailMessage.From = new MailAddress("myaccount@gmail.com");
            mailMessage.To.Add(email);
            mailMessage.Body = body;
            mailMessage.Subject = "Serials";
            client.Send(mailMessage);
        }

Best Regards.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>