Hyrozen Hyrozen - 25 days ago 13
ASP.NET (C#) Question

Email sending from 1and1 SMTP server

Trying to send email from 1and1 smtp server in ASP :

MailMessage Msg = new MailMessage();
Msg.From = new MailAddress("admin@mywebsite.com");
Msg.To.Add("personalmail");
SmtpClient smtp = new SmtpClient("auth.smtp.1and1.fr",465);
smtp.Credentials = new NetworkCredential("admin@mywebsite.com", "mypassword");
smtp.EnableSsl = true;
try
{
// smtp.Send(Msg);
smtp.Send(Msg);
return "ok";
}
catch (Exception e)
{
return e.ToString();
}


The code goes in the catch with the error called :"net_io_connectionclosed"
Do Someone know this problem ?
Regards

Answer

Hyrozen,

You have to use Port 587.