我使用系统类using System.Web.Mail;
发邮件,没有提示错误.但是我收不到.怎么会事.
代码:
System.Web.Mail.MailMessage objmail=new MailMessage();
objmail.From="[email protected]";
objmail.To=txtEmail.Text.ToString();
objmail.Subject="你好";
objmail.Body=txt_code.Text.ToString();
objmail.BodyFormat=MailFormat.Text;
objmail.Priority=MailPriority.Normal;
SmtpMail.SmtpServer="localhost";
SmtpMail.Send(objmail);

解决方案 »

  1.   



    MailMessage msgMail = new MailMessage();
    msgMail.From = mailFrom;
    msgMail.To = mailTo;
    msgMail.Subject = mailTitle;
    //msgMail.Priority = MailPriority.Normal;
    //msgMail.BodyFormat = MailFormat.Html;
    msgMail.Body = mailBody;
    msgMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");   
    //basic authentication
    msgMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", username);
     //set your username here

    msgMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password);
     //set your password here
    SmtpMail.SmtpServer = smtpServer;
    SmtpMail.Send(msgMail);
      

  2.   

    你的SMTP Server有没有问题 ,如果需要验证的话  要加上msgMail.Fields.Add......
    你可以用外面其它的邮箱的smtp Server先试一下 上面的代码我是用过的 没问题