Send mail using localhost SMTP

后端 未结 6 1972
失恋的感觉
失恋的感觉 2020-12-14 07:41

I am trying to setup SMTP server on IIS for sending mails. The SMTP server is intended to be used by the ASP.NET code in C#.

I was previously using gmail smtp where

6条回答
  •  萌比男神i
    2020-12-14 08:18

    If you want to test emails in localhost, just download install the papercut tool https://papercut.codeplex.com/

    and change hostname to localhost as below. Papercut captures all the emails sending using localhost.

      smtpClient.UseDefaultCredentials = false;
        smtpClient.Host = "localhost";
        smtpClient.Port = 587;
        smtpClient.Credentials = new NetworkCredential(uname,pwd);
        smtpClient.EnableSsl = true;
    

提交回复
热议问题