MailMessage MailObj=new MailMessage();
MailObj.From = sender;//发件人
MailObj.To = receiver;//收件人
MailObj.Subject =subject; //邮件标题
MailObj.Priority = MailPriority.High;//邮件等级
MailObj.BodyFormat = MailFormat.Text;
MailObj.Body =body;//邮件内容
#region SMTP的注册信息

MailObj.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2;
//用smtp Server用外部的,把SendUsing外部是2,内部为1
MailObj.Fields["http://schemas.microsoft.com/cdo/configuration/sendemailaddress"] = sender;
MailObj.Fields["http://schemas.microsoft.com/cdo/configuration/smtpaccountname"] = sender;
MailObj.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = sender;
MailObj.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = sendPassword;
#region 是否验证SMTP
//value=0 代表Anonymous验证方式(不需要验证)
//value=1 代表Basic验证方式(使用basic (clear-text) authentication. 
//Value=2 代表NTLM验证方式(Secure Password Authentication in Microsoft Outlook Express)
MailObj.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 0;
// if(Mail.nSmtpAuthenticate != 0 )
// {
// MailObj.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = Mail.nSmtpAuthenticate;
// }
#endregion

//已经约定的格式
MailObj.Fields["http://schemas.microsoft.com/cdo/configuration/languagecode"] = 0x0804;
MailObj.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = "smtpServer";
#endregion
SmtpMail.Send(MailObj);

解决方案 »

  1.   

    http://www.systemwebmail.com/faq/3.8.aspx
      

  2.   

    private void Page_Load(object sender, System.EventArgs e)
    {
    MailMessage mail = new MailMessage();
    mail.To = "[email protected]";
    mail.From = "[email protected]";
    mail.Subject = "this is a test email.";
    mail.Body = "Some text goes here";
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here"); //set your username here
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret"); //set your password here SmtpMail.SmtpServer = "mail.mycompany.com";  //your real server goes here
    SmtpMail.Send( mail );
    }