I'm trying to enable 'User Registration' on my web site but have (obviously) not found the correct combination for the e-mail parameters! Any combination gives: "Failure sending mail" Based on the Winhost knowledge base I have set it according to below XML schema! ? Thank you for correcting me; I'm obviously wrong or something is missing! thanks for your time ed PS: any special considerations when using GMAIL?! KNOWLEDGE BASE: Mail server hostname (When configuring your email program, replace "HostingAccountDomain.com" in the examples below with your domain name.) •POP3 server hostname: mail.HostingAccountDomain.com •IMAP server hostname: mail.HostingAccountDomain.com •SMTP server hostname: mail.HostingAccountDomain.com •Webmail server hostname: mail.HostingAccountDomain.com POP and IMAP login name The login name for your POP and IMAP accounts is the full emailaddress, not just the user name. For example, if you create the POPaccount "[email protected]," the login name is"[email protected]" not "user." You must use the full emailaddress as the login name. MY WEB SITE DEFINITION: <?xml version="1.0"?> <WebSiteData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <HomepageId>123d2cb2-0e92-4bc2-8295-ba6c5ad036d4</HomepageId> <Theme>Golf</Theme> <Language>en-US</Language> <MailSenderAddress>[email protected]</MailSenderAddress> <SmtpServer>mail.HostingAccountDomain.org</SmtpServer> <SmtpUser>mail.HostingAccountDomain.org</SmtpUser> <SmtpPassword>xyz</SmtpPassword> <SmtpDomain>HostingAccountDomain.org</SmtpDomain> <FooterText>cc ASGB</FooterText> <WebSiteTitle /> <Keywords>xyz</Keywords> <Description>WEB Site .....</Description> <EnableSectionRss>true</EnableSectionRss> <EnableIE8CompatibilityMetatag>true</EnableIE8CompatibilityMetatag> <AllowUserSelfRegistration>true</AllowUserSelfRegistration> <EnableVersionChecking>true</EnableVersionChecking> </WebSiteData> ROUTINE to send mail: //Send email to user for verifying account MembershipUser user = Membership.GetUser(createUserWizard.UserName); string url = string.Concat("http://", Request.Url.Authority, Response.ApplyAppPathModifier("~/Login.aspx?activate=")); MailMessage mail = new MailMessage(_website.MailSenderAddress, user.Email); mail.SubjectEncoding = System.Text.Encoding.UTF8; mail.Subject = string.Format(Resources.StringsRes.pge_UserRegistration_ActivationEmailSubject, "ASGB"); //mail.Subject = string.Format(Resources.StringsRes.pge_UserRegistration_ActivationEmailSubject, _website.WebSiteTitle); mail.BodyEncoding = System.Text.Encoding.UTF8; mail.IsBodyHtml = false; mail.Body = string.Format(Resources.StringsRes.pge_UserRegistration_ActivationEmailBody, "ASGB", url, user.ProviderUserKey.ToString()); //mail.Body = string.Format(Resources.StringsRes.pge_UserRegistration_ActivationEmailBody, _website.WebSiteTitle, url, user.ProviderUserKey.ToString()); SmtpClient client = new SmtpClient(_website.SmtpServer); //when Smtp user/password/domain is given, SMTP-Authentication has to be used if (_website.SmtpUser != "" && _website.SmtpPassword != "" && _website.SmtpDomain != "") { client.UseDefaultCredentials = false; client.Credentials = new NetworkCredential(_website.SmtpUser, _website.SmtpPassword, _website.SmtpDomain); } client.Send(mail);
Make sure you replace "postmaster@HostingAccountDomain .org" with your actual domain name. Remember the kb article is written as an example, and you should replace hostingaccoutndomain.org as your actual domain name.
Hi Ray + Hank, thanks for your time.1 changing the domain name to mine is understood. Ray: because I read some issues re gmail I asked. In my case I only use gmail privately NOT on a private domain! So, I assume no special considerations! ed
Sorry for coming back. I read the Winhost email forums but still do not have an answer ... might be, however, I missed something in the definitions of SmarterMail ....? when using for From: [email protected] To: [email protected] (this a valid gmail address; i changed to i.h for sec reasons). This gives below error msg. (no such user here, of course I did not define [email protected] in SmarterMail) Question: do I need to define anything in SmarterMail to send to any non-SmarterMail address? thanks for your advise. ed PS: when sending TO: Postmaster... I get it because i set forwarding in SmarterMail! ERROR MESSAGE: Mailbox unavailable. The server response was: <[email protected]> No such user here Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: <[email protected]> No such user here Source Error: Line 57: } Line 58: Line 59: client.Send(mail); Line 60: } Line 61: Source File: e:\web\asgbarba\UserRegistration.aspx.cs Line: 59 Stack Trace: [SmtpFailedRecipientException: Mailbox unavailable. The server response was: <[email protected]> No such user here] System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) +1087059 System.Net.Mail.SmtpClient.Send(MailMessage message) +1480 UserRegistration.createUserWizard_CreatedUser(Object sender, EventArgs e) in e:\web\asgbarba\UserRegistration.aspx.cs:59
It sounds like you are not setting up SMTP authentication correctly. Try looking a this kb article for an example of how to code your web page to send email through our SMTP server. http://support.Winhost.com/KB/a650/how-to-send-email-in-aspnet.aspx What you should do first is create a simple test script like the one given on this kb article so you can get familiar with coding ASP.Net to send email and pass SMTP authentication. Then from there once you understand the code you can try to integrate it with your web application.
Ray, thanks for your time based on the sample I have now a running versio. It seems that certain encoding parameters weren't correct. will further evaluate. But, I consider this thread closed Thanks again, ed