I am trying to send a simple email, for example, to test@blabla.com
First of all, I already tried this in my Localhost and it worked, the problem was when I uploaded it to my server
The server I use is a Windows 2012 R2 server, with IIS 7 (not quite sure of the version, but I believe that 7 and above) succeeded without problems, just the method of sending email does not work ...
I already have SMTP function, install SMTP E-MAIL (Yes, in IIS 7 and above there is no virtual SMTP server)
here is my controller
public ActionResult SendTestEmail()
{
var test_address = "test@blabla.com";
try
{
WebMail.SmtpServer = "localhost";
WebMail.SmtpPort = 25;
WebMail.EnableSsl = false;
WebMail.UserName = "";
WebMail.Password = "";
WebMail.From = "admin@testserver.com";
WebMail.Send(to: test_address,
subject: "Test email message",
body: "This is a debug email message"
);
}
catch (Exception ex)
{
ViewBag.errorMessage = ex.Message;
}
return View();
}
here are my SMTP email settings:

: . : 5.7.1 test@blabla.com( , , , , sample@email.com/ )