我有一个WebForm如果有人可以建立一个帐户 - 我想发送一封电子邮件确认。
我正在使用的代码:
// Create e-mail message
MailMessage mm = new MailMessage();
mm.From = new MailAddress("OurOrganisationEmail@ourdomain.com", "Our Organisation");
mm.To.Add(new MailAddress("webuser@domain.com", "Web User"));
mm.Subject = "Confirmation";
mm.Body = "You are now registered test";
mm.IsBodyHtml = true;
// Send e-mail
sc = new SmtpClient();
NetworkCredential basicAuthenticationInfo = new NetworkCredential(“OurOrganisationEmail@ourdomain.com”, “ourorganisationemailPassword”);
sc.Credentials = basicAuthenticationInfo;
sc.UseDefaultCredentials = false;
sc.Send(mm);
web.config中:
<system.net>
<mailSettings>
<smtp>
<network host="mail.OurOrganisationEmail@ourdomain.com" port="9999" userName="OurOrganisationEmail@ourdomain.com" password="OurOrganisationEmailPassword"/>
</smtp>
</mailSettings>
</system.net>
但得到:
System.Net.Mail.SmtpFailedRecipientException was caught
HResult=-2146233088
Message=Mailbox unavailable. The server response was: Authentication is required for relay
Source=System
FailedRecipient=<webuser@domain.com>
看起来像它想要的,我想要发送到Web地址的用户登录信息。 我怎样才能修改这一点,并发送这样的确认电子邮件像所有其他商业公司怎么办?