谢谢楼上的提醒。我重新注册了一个21cn的邮箱,帐号lt2301@21cn.com 密码123abc
代码如下
using System.Net.Mail;
private void button1_Click(object sender, EventArgs e)
{
//string file = @"e:/a.txt";
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage("lt2301@21cn.com", "lt2301@21cn.com", "text message for you.", "Test Title");
//System.Net.Mail.Attachment data = new System.Net.Mail.Attachment(file, System.Net.Mime.MediaTypeNames.Application.Octet);
//System.Net.Mime.ContentDisposition disposition = data.ContentDisposition;
//disposition.CreationDate = System.IO.File.GetCreationTime(file);
//disposition.ModificationDate = System.IO.File.GetLastWriteTime(file);
//disposition.ReadDate = System.IO.File.GetLastAccessTime(file);
//message.Attachments.Add(data);
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("smtp.21cn.com");
client.Credentials = new System.Net.NetworkCredential("lt2301", "123abc");
client.Send(message);
//data.Dispose();
}
代码运行到client.Send(message);时,产生错误“语法错误,无法识别命令。 服务器响应为: authen
tication failed,decode user password error”,请高手指点