C# Failed to send emails using Smtpclient

Asked

Viewed 654 times

0

I am getting the following error while running the system on the server with port 587: Mailbox not available

Error stack:

inserir a descrição da imagem aqui

When I change the door to 465 and Smtpserver.Enablessl = true; timeout occurs;

I run the same system on my local machine and it works normally with port 587.

Source code used:

MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("host");
mail.From = new MailAddress("email");
mail.To.Add("to");
mail.Subject = "teste"
mail.Body = "teste";

SmtpServer.Port = 587;
SmtpServer.Credentials = new 
System.Net.NetworkCredential("login", "senha");
SmtpServer.EnableSsl = false;
SmtpServer.Send(mail);
  • can be a firewall problem, but by the mansage part that can be read, it seems that you are not authenticating with the same email account that you are using to send the message.

  • I tested with firewall disabled and error persisted.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.