I hope someone can help. I have the following problem: I have a new account with DiscountASP at a temporary address and their support team is not able to answer problem other than to state standard line that I should use "localhost" smtp settings. I can only send mail with specific smtp settings, "localhost" doesn't work. I can send mail via: new SmtpClient().Send(msg) code but not using the CreateUserWizard (which I see as the problem) My problem is I can't send mail from my resgister.aspx page which uses code below to send email: protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e) { // Customize the mail body by replacing the placeholders in the static mail body file with actual values e.Message.Body = e.Message.Body.Replace("#Id#", Membership.GetUser (CreateUserWizard1.UserName).ProviderUserKey.ToString()); e.Message.Body = e.Message.Body.Replace("#UserName#", CreateUserWizard1.UserName); } This code works fine on existing host. I have not transfered domain A record to discountASP site yet while in "testing" mode. So I guess the problem relates to running on another domain. I can send mail ok on my site with discountASP via my Query.aspx page which uses this code: // send the mail MailMessage msg = new MailMessage(); msg.IsBodyHtml = false; msg.From = new MailAddress(txtEmail.Text, txtName.Text); //msg.To.Add(new MailAddress (Globals.Settings.ContactForm.MailTo)); if (Session["email"] != null) { msg.To.Add(new MailAddress((string)Session["email"])); } else { msg.To.Add(new MailAddress("[email protected]")); } if (!string.IsNullOrEmpty(Globals.Settings.ContactForm.MailCC)) msg.CC.Add(new MailAddress (Globals.Settings.ContactForm.MailCC)); msg.Subject = string.Format (Globals.Settings.ContactForm.MailSubject, txtSubject.Text); msg.Body = txtBody.Text; new SmtpClient().Send(msg); Because I can send mail ok via Query page I presume my web.config settings are fine. I get the following error trying to send mail from Register.aspx page: Mailbox name not allowed. The server response was: sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1) StackTrace at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) To summarise: Can I alter CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e) code to stop wizard sending mail (which it seems unable to do so from my site at discountASP (while using temporary address) and send mail through similar code to that in Query.aspx.cs?
Hi Bruce smtp settings in web.config are: <smtp deliveryMethod="Network" from="M.D.O'Shea & Sons <[email protected]>"> <network host="mail.webhotel.net" userName="mdoshea-54" password="deWsCr5p" port="5500"/> </smtp> Hope this helps
Simple solution I was basically confused with being able to send email okay via SmtpClient with old settings which did specify host and not being successful via CreateUserWizard with same settings. Anyhow simple solution just used the following settings which work for both sending mail methods: <smtp deliveryMethod="Network" from="emailaddress"> <network defaultCredentials="false" host="localhost" userName="username" password="password" port="25"/> </smtp> Perhaps it might be good idea for discountASP to list above for idiots like me!