0

我创建了一个注册页面,在注册后通知用户。下面的代码适用于同一域名下的用户,但无法使用外部域电子邮件帐户。它不会返回任何错误,并且接收者也不会收到电子邮件。

    ...some codes here...
    string bodymsg="test email";       

    MailMessage mMailMsg = new MailMessage();
    mMailMsg.From = new MailAddress("applications@mydomain.com");
    mMailMsg.To.Add(new MailAddress(mailto));

    mMailMsg.Subject = "test email";
    mMailMsg.Body = bodymsg;
    mMailMsg.IsBodyHtml = true;
    mMailMsg.Priority = MailPriority.Normal;

    SmtpClient msmtpclient = new SmtpClient();

    msmtpclient.Send(mMailMsg);

网页配置

<mailSettings>
  <smtp>        
    <network host="mail.mydomain.com" password="pwd" userName="applications@mydomain.com" defaultCredentials="false" port="25"/>
  </smtp>
</mailSettings>

提前致谢。

4

1 回答 1

0

I think you have to specify the Server

For example :

mMailMsg.Server = [name of your mail server];

For example my server IP address is : 192.168.1.137

so I specify :

mMailMsg.Server = 192.168.1.137;

specify before sending email.

于 2012-11-16T22:12:05.957 回答