MailMessage aMessage = new MailMessage ( ) ;
//新建一个MailMessage对象
aMessage.From = "[email protected]" ;
//定义发信人地址,如果是多人,可以用","分开
aMessage.To = txtSendTo.Text ;
aMessage.Subject = txtSubject.Text ;
//定义邮件的主题
aMessage.Body = txtContent.Text ;
//定义邮件的内容
SmtpMail.Send ( aMessage ) ;
//发送电子邮件
MessageBox.Show( "电子邮件已经发送到->" + txtSendTo.Text ) ;
程序没出任何错误,但是就是收不到邮件我是winform的程序

解决方案 »

  1.   

    <p>
    Configuration conf=new ConfigurationClass();
    conf.Fields[CdoConfiguration.cdoSendUsingMethod].Value
    =CdoSendUsing.cdoSendUsingPort;
    conf.Fields[CdoConfiguration.cdoSendEmailAddress].Value="[email protected]";
    conf.Fields[CdoConfiguration.cdoSendPassword].Value="xxxxxx";
    conf.Fields[CdoConfiguration.cdoSMTPServer].Value="mail.xxx.xxx";
    conf.Fields[CdoConfiguration.cdoSendUserName].Value="[email protected]";
    //发送者名称,这一项要注意检查,不可以乱写
    conf.Fields[CdoConfiguration.cdoSMTPServerPort].Value=25;
    conf.Fields[CdoConfiguration.cdoSMTPAuthenticate].Value
    =CdoProtocolsAuthentication.cdoBasic;
    conf.Fields.Update();
    </p>
      

  2.   

    aMessage.From = "[email protected]" ;
    这里用的是哪个网站的邮箱,你那个smpt.server指定的吗啊??
      

  3.   

    SMTP服务器是什么?你没有指定。
      

  4.   

    aMessage.From = "[email protected]" 和你的smtp server
    会造成一些邮件服务器把你发的邮件当成垃圾
      

  5.   

    我看你代码里面没有指定SMTP的服务器。你可以自己在IIS里面做一个SMTP服务器或者用网站上的SMTP服务器,不过网站上的好象很多都是要密码验证的。
    SMTP服务器的指定SmtpMail.SmtpServer="localhost";后面是你的服务器,我是用自己的IIS做的