I am trying to connect my server from .NET 6.0, but it takes a long time, and after that, it just won’t connect!
Here is my code :
using var smtp = new SmtpClient();
smtp.Connect("mail.uri.com", 25, SecureSocketOptions.StartTls);
smtp.Authenticate("username", "password");
smtp.Send(email);
smtp.Disconnect(true);
It gets stuck at first line (smtp.Connect
) and won’t go further.
I expected to link to the server and send an email to the target ’email’, but it gets stuck at smtp.Connect
New contributor
Mohammad Ali Ghasemian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.