错误的命令序列。 [英] Bad sequence of commands.

查看:77
本文介绍了错误的命令序列。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在发送邮件时得到了这个:



错误的命令序列。服务器响应是:此邮件服务器在尝试发送到非本地电子邮件地址时需要身份验证。请检查您的邮件客户端设置或联系您的管理员以验证是否为此服务器定义了域或地址。





 SmtpClient sC =  new  SmtpClient(  domain.com); 
sC.Host = ConfigurationManager.AppSettings [ servername];
sC.Port = 25 ;
sC.Credentials = new System.Net.NetworkCredential( username password);
// smtp.EnableSsl = true;

sC。发送(mM);

解决方案

domain.com提供的构造函数将替换为您从应用程序设置中指定的Host属性,使用其中一个属性并给出smtp主机名正确,例如它是gmail smtp smtp.gmail.com

I have got this this during mail send:

Bad sequence of commands. The server response was: This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server.


SmtpClient sC = new SmtpClient("domain.com");
                sC.Host = ConfigurationManager.AppSettings["servername"];
                sC.Port = 25;
                sC.Credentials = new System.Net.NetworkCredential("username","password");
//smtp.EnableSsl = true;

                sC.Send(mM);

解决方案

"domain.com" which provided in the constructor will be replaced by the Host property you specify from the app settings, use one of those properties and give smtp host name correcty, for example is it is gmail smtp smtp.gmail.com


这篇关于错误的命令序列。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆