Reputation: 339
i have this web application written in C# under ASP.NET 4.0 that runs on a Windows 2008 server. I want to send emails to users from [email protected] but i am unable to. I'm using the following method (which worked using smtp.gmail.com) and using System.Net.Mail;
string from = "[email protected]";
string password = "12345";
MailMessage mail = new MailMessage();
mail.To.Add(to);
mail.From = new MailAddress(from);
mail.Subject = title;
mail.Body = message;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "stmp ip here";
smtp.Port = 25;
smtp.Credentials = new System.Net.NetworkCredential(from, password);
smtp.EnableSsl = false;
smtp.Send(mail);
I have installed and configure SMTP server using basic authentication and outbound security -> basic authentication (using [email protected] and 12345 as password). In IIS7 on my website i clicked on SMTP E-mail and entered the ip of my SMTP server together with the credentials from above.
Before doing all this config, i run into problems like the emails being stuck in the queue folder, server does not support ssl connections and others. Now, the only error i receive when sending email is logged from my application: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.3 Client was not authenticated and the email is not arriving at destination. The Queue folder is empty and i don't have any errors from the SMTP server log!
I did alot of research on google about it but i can't fix it. Telnet is working as it should, port 25 is not blocked and disabling windows firewall is not helping either. I'm really stuck. Any ideas? Thanks!
Upvotes: 1
Views: 3148
Reputation: 10320
Sounds like the server may require you to set 'EnableSsl' to 'true'. So, you could either try to disable this on your server or simply set 'EnableSSl = true' in your client. You will probably then need to change the port to 587 or (sometimes) 465.
Upvotes: 1