S
S
Sneiksus2020-09-17 18:18:44
ASP.NET
Sneiksus, 2020-09-17 18:18:44

Why is smtp email not being sent?

MailAddress from = new MailAddress("email", "name");
            MailAddress to = new MailAddress("email");
            MailMessage m = new MailMessage(from, to);
            m.Body = $"text";
            SmtpClient smtp = new SmtpClient("server", 25);
            smtp.UseDefaultCredentials = false;
            smtp.Credentials = new NetworkCredential("email", "password");
            smtp.EnableSsl = false;
            smtp.Send(m);


Email is not sent from the asp.net core application, throws a SocketException. The server is working and the data is correct (checked through the smtp tester)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
akelsey, 2020-09-17
@akelsey

checked with smtp tester

What works from one place may not work from another. With a simple "telnet server 25" try from the machine where the code is running.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question