开启并设置你的IIS的smtp服务器没有?

解决方案 »

  1.   

    邮件就是发不出去呀!在C:\Inetpub\mailroot\Queue里有好多的邮件,我的设置如下:默认 smtp虚拟服务器》》访问控制 》》匿名访问,连接控制》》仅以下列表除外,中继限制》》仅下面的表。。127.0.0.1
      

  2.   

    private void Button1_Click(object sender, System.EventArgs e)
    {
    MailMessage mail = new MailMessage();
    mail.To = "[email protected]";
    mail.From = "[email protected]";
                              yourcompany换成你本地的服务器的名字,或者是你的域名。
    mail.Subject = "this is a test email.";
    mail.Body = "this is my test email body";
    //SmtpMail.SmtpServer = "localhost";  //your real server goes here           这句完全可以去掉,默认是本地的如果本地不可用,自动寻找网络上可用的只能服务器。  
    SmtpMail.Send( mail );
      

  3.   

    to zhanqiangz:
    private void Button1_Click(object sender, System.EventArgs e)
    {
    MailMessage mail = new MailMessage();
    mail.To = "[email protected]";
    //mail.From = "[email protected]";
                                mail.From = "[email protected]"; 
                              yourcompany换成你本地的服务器的名字,或者是你的域名。我的默认的smpt虚拟服务器>>域名>>cyg ,因此我改为 mail.From = "[email protected]"; 可还是发不出去呀!
    mail.Subject = "this is a test email.";
    mail.Body = "this is my test email body";
    //SmtpMail.SmtpServer = "localhost";  //your real server goes here           这句完全可以去掉,默认是本地的如果本地不可用,自动寻找网络上可用的只能服务器。 >>>次句我已删了!  
    SmtpMail.Send( mail );