且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法使用SMTP发送电子邮件到外部域

更新时间:2022-04-10 07:38:57

我有这个问题和认证固定如下所示:

I had this issue and authenticating fixed it see below:

        SmtpClient client = new SmtpClient(EmailServer, 25);
        var SmtpUser = new System.Net.NetworkCredential("domain\\username", "password");
        client.Credentials = SmtpUser;
        client.DeliveryMethod = SmtpDeliveryMethod.Network;

我不得不使用双斜杠,因为一个斜杠是转义字符,所以使用两个它来工作。

I had to use the double slash since one slash is the escape character so use two for it to work.