Search code examples
c#asp.netemailsmtpwebmail

Email sending from 1and1 SMTP server


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

 MailMessage Msg = new MailMessage();
        Msg.From = new MailAddress("[email protected]");
        Msg.To.Add("personalmail");
        SmtpClient smtp = new SmtpClient("auth.smtp.1and1.fr",465);
        smtp.Credentials = new NetworkCredential("[email protected]", "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


Solution

  • Hyrozen,

    You have to use Port 587.