354 start mail input; end with <crlf>.<crlf>
421 <domain> service not available,
closing transmission channel
[this may be a reply to any command if the service knows it
must shut down]
450 requested mail action not taken: mailbox unavailable
[e.g., mailbox busy]
451 requested action aborted: local error in processing
452 requested action not taken: insufficient system storage
500 syntax error, command unrecognized
[this may include errors such as command line too long]
501 syntax error in parameters or arguments
502 command not implemented
503 bad sequence of commands
504 command parameter not implemented
550 requested action not taken: mailbox unavailable
[e.g., mailbox not found, no access]
551 user not local; please try <forward-path>
552 requested mail action aborted: exceeded storage allocation
553 requested action not taken: mailbox name not allowed
[e.g., mailbox syntax incorrect]
554 transaction failed
*/
errcodeht.add("421","服务未就绪,关闭传输信道");
errcodeht.add("432","需要一个密码转换");
errcodeht.add("450","要求的邮件操作未完成,邮箱不可用(例如,邮箱忙)");
errcodeht.add("451","放弃要求的操作;处理过程中出错");
errcodeht.add("452","系统存储不足,要求的操作未执行");
errcodeht.add("454","临时认证失败");
errcodeht.add("500","邮箱地址错误");
errcodeht.add("501","参数格式错误");
errcodeht.add("502","命令不可实现");
errcodeht.add("503","服务器需要smtp验证");
errcodeht.add("504","命令参数不可实现");
errcodeht.add("530","需要认证");
errcodeht.add("534","认证机制过于简单");
errcodeht.add("538","当前请求的认证机制需要加密");
errcodeht.add("550","要求的邮件操作未完成,邮箱不可用(例如,邮箱未找到,或不可访问)");
errcodeht.add("551","用户非本地,请尝试<forward-path>");
errcodeht.add("552","过量的存储分配,要求的操作未执行");
errcodeht.add("553","邮箱名不可用,要求的操作未执行(例如邮箱格式错误)");
errcodeht.add("554","传输失败");
/*
211 system status, or system help reply
214 help message
[information on how to use the receiver or the meaning of a
particular non-standard command; this reply is useful only
to the human user]
220 <domain> service ready
221 <domain> service closing transmission channel
250 requested mail action okay, completed
251 user not local; will forward to <forward-path>
354 start mail input; end with <crlf>.<crlf>
*/
rightcodeht.add("220","服务就绪");
rightcodeht.add("221","服务关闭传输信道");
rightcodeht.add("235","验证成功");
rightcodeht.add("250","要求的邮件操作完成");
rightcodeht.add("251","非本地用户,将转发向<forward-path>");
rightcodeht.add("334","服务器响应验证base64字符串");
rightcodeht.add("354","开始邮件输入,以<crlf>.<crlf>结束");
}
/// <summary>
/// 发送smtp命令
/// </summary>
private bool sendcommand(string str)
{
byte[]writebuffer;
if(str==null||str.trim()==string.empty)
{
return true;
}
logs+=str;
writebuffer = encoding.default.getbytes(str);
try
{
networkstream.write(writebuffer,0,writebuffer.length);
}
catch
{
errmsg="网络连接错误";
return false;
}
return true;
}
/// <summary>
/// 接收smtp服务器回应