I have recently moved the web app from one server to another. No changes in the code or web config (apart from database connection) has been done.
In the old server, the application could send emails. In the new server, this error arises. Is there a configuration that I am missing here? I looked in IIS Manager, and the SMTP Email is not even activated in the old server. It seems to be an authentication issue, I do not know how the authentication works in this case.
I have not done the configuration in the old server so I do not know where to look.
public MailHelper(string sender, string recipient)
{
NetworkCredential cred = new NetworkCredential(SmtpUser, SmtpPassword);
message = new MailMessage(sender, recipient);
client = new SmtpClient();
client.Port = 25;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = true;
client.Host = SmtpHost;
}
public void Send(string subject, string body)
{
message.Subject = subject;
message.IsBodyHtml = true;
message.Body = body;
client.Send(message);
}
What are my next steps?
Cheers.
image of stacktrace: https://ibb.co/fd2jwPG