Reputation: 4165
We recently moved our email addresses to be hosted at Rackspace. I needed to update my C# code for sending email from our website using SMTP. Doing some searches I found that the settings should be:
I set the port property of the SMTP client control to 465, but received an error that said "The server response was: 5.7.1 : Sender address rejected: Access denied". Then I made sure to set the EnableSsl property to true, but I still received and error of "System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed"
Upvotes: 0
Views: 317
Reputation: 4165
Switching the port to 587 solved the problem. Even though the Rackspace support page said "465 or 587", 465 did not work, but 587 did. Here is the C# code I used with all of the relevant settings:
System.Net.Mail.SmtpClient sc = new System.Net.Mail.SmtpClient("secure.emailsrvr.com");
sc.EnableSsl = true;
sc.Port = 587;
sc.Credentials = new System.Net.NetworkCredential("[email protected]", "*********");
sc.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
sc.Send(email);
Upvotes: 0