Senden Sie E-Mail mit Outlook.com SMTP

Ich bin versucht, senden Sie eine automatisierte E-Mail mit Outlook.com smtp-Unterstützung. Aber ich bin erhalten die folgende Ausnahme:

System.Net.Mail.SmtpException: Failure sending mail.  
---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.  
---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host" Exception while sending email.

Mein code:

    public bool SendEmail(MailMessage msg)
    {
        try
        {
            SmtpClient smtpClient = new SmtpClient("smtp-mail.outlook.com")
            {
                UseDefaultCredentials = false,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                Credentials = new NetworkCredential("userAddress", "userPassword"),
                Port = 587,
                EnableSsl = true,
            };
            smtpClient.Send(msg);
            msg.Dispose();
            smtpClient.Dispose();
            return true;
        }
        catch (Exception exp)
        {
            Console.WriteLine(exp.ToString());
            return false;
        }
    }
  • Sie haben versucht mit: smtp.live.com?
  • Eingehender mail-server: pop3.live.com Outgoing mail server (SMTP): smtp.live.com
  • Ja, ich habe versucht, mit smtp.live.com wie gut. Aber die Ausnahme wird noch geworfen
  • Haben Sie versucht, die "smtp.office365.com"?
  • Mein account ist nur die regelmäßige Outlook.com kostenloses Konto. Also ich vermute, wenn office365 bezahlt smtp funktionieren würde!
InformationsquelleAutor Andy | 2013-09-18
Schreibe einen Kommentar