Error while authentication using C# console app

  • Thread starter Thread starter Yerkhan
  • Start date Start date
Y

Yerkhan

Guest
Hi everyone,

I have C# console app to send automatic emails. I have local email server, and I can't authenticate to it.

Here is my code:

SmtpClient client = new SmtpClient("[IP address]", [port]);
client.EnableSsl = false;
MailAddress from = new MailAddress("[mailfrom]");
MailAddress to = new MailAddress("[some]@gmail.com");
MailMessage message = new MailMessage(from, to);
message.Body = "This is a test e-mail message sent using a relay server ";
message.Subject = "test email";
client.UseDefaultCredentials = false;
NetworkCredential myCreds = new NetworkCredential("[mailfrom]", "[password]");
client.Credentials = myCreds;
client.Send(message);


At the end, I get following error:

1492421.png

How can I connect to it?

There is no restrictions on email server, i need only to authenticate.

Regards,

Yerkhan

Continue reading...
 
Back
Top