那是因为没有指定发送的服务:
你可以在iis里添加本地地址到SMTP的"Default SMTP Virtual Server"
或者把你要发送的email的smtp服务设置到SmtpMail的属性SmtpServer,然后再发送。

解决方案 »

  1.   

    我在"Default SMTP Virtual Server"上的“常规”--“IP地址”已设置了本地地址了,SmtpMail.SmtpServer也设置了本地地址,可是还是不行啊,还望公主再指点!
      

  2.   

    有这样一段测试代码:
    using System;
    using System.Web.Mail;public class sendmail 
    {
        public static void Main(String[] args) 
    {
            if (args.Length != 3) {
              Console.WriteLine("Usage: sendmail sender reciever SMTPServer");
              return ;
            }        SmtpMail.SmtpServer = args[2]; // Send the string content
    Console.WriteLine("Sending mail with string content case...");
            SmtpMail.Send(args[0], args[1], "Hello,iNet !", "[string]iNet is the best chance for you now !");
    Console.WriteLine("Sent the mail with string content case successfully !"); // Send the MailMessage.
    MailMessage myMail = new MailMessage();
    myMail.From = args[0];
    myMail.To = args[1];
    myMail.Subject = "Hello,iNet!";
    myMail.Priority = MailPriority.High;
    myMail.Body = "[mailmessage]iNet is the best chance for you now !"; Console.WriteLine("\nSending mail with the mailmessage case...");
    SmtpMail.Send(myMail);
    Console.WriteLine("Sent the mail with the mailmessage case successfully !");
        }
    }
    你用你的数据测试一下,如果不行,那是smtpserver的名字错了。
      

  3.   

    我测试了,可以,我也收到的email,但是有点很重要,就是第三个参数,如果不对或者这个服务不支持外部邮件发送的话就不能发。
      

  4.   

    我想这个地址是对的且这个服务是可以支持外部邮件,因为我在这部机用outlook设置了一个本地地址的邮箱,然后用它发邮件也可以发出去,并收到,但用c#程序可以发出去,但收不到,我就不知道是啥原因了。