I am having issues sending a confirmation email to user after registration. I've tried 2 Hotmail email and I got Mailbox unavailable error. It show "System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: <[email protected]> No such user here". I read some threads, but I couldn't get an answer. The first time, I used my own Hotmail email, and the second time I used my brother's email. I got the same error message. I successfully logged into my account on mail.mydomain.com with the username [email protected], and from there I can send an email to the Hotmail account. But from my Winhost hosted website, It does not work. Can anyone provide help? Here is my web.config <system.net> <mailSettings> <smtpfrom="[email protected]"> <networkhost="mail.mydomainname.com"password="mypa$$w0rd" userName="[email protected]"defaultCredentials="true" /> </smtp> </mailSettings> </system.net> ================== Here is the VB code behind Dim TextMsg AsString = "Thanks for registering..." Dim SenderEmail AsString = Trim(txtUserEmail.Text) Dim SenderName AsString = Trim(txtName.Text) Dim MailMsg AsNewMailMessage() MailMsg.BodyEncoding = Encoding.Default MailMsg.Subject = "Welcome to..." MailMsg.Body = TextMsg MailMsg.Priority = MailPriority.High MailMsg.IsBodyHtml = True MailMsg.From = NewMailAddress("[email protected]", "Domain Moto") MailMsg.To.Add(NewMailAddress(SenderEmail, SenderName)) 'SmtpClient to send the mail message Dim SmtpMail AsNewSmtpClient SmtpMail.Send(MailMsg) ================ After I enable debug=true in the web.config, it pointed out the line SmtpMail.Send(MailMsg). I don't know what it wrong. I can see in the database that the user has been added, but still I can't send a confirmation email to Hotmail account.
This usually means the credential is not being passed. Please open a support ticket if it still doesn't work. We can certainly take a look at it.
I opened a ticket, but the support I got was not satisfactory. Anybody has an idea why this problem is happening? My code can send, and does send an email, but unfortunately the email to external network such as Hotmail, webmails, yahoo does not work. A copy of the email is correctly send into my domain's email account on winhost. I review my web.config file, and here is what I actually have. <system.net> <mailSettings> <smtp from="[email protected]"> <network host="mail.mydomain.com" password="myPas$w0rd" port="25" userName="[email protected]" defaultCredentials="true" /> </smtp> </mailSettings> </system.net> Here is my code behind Dim SenderEmail As String = Trim(txtEmail.Text).ToString Dim SenderName As String = Trim(txtName.Text).ToString Dim MailMsg As New MailMessage() MailMsg.BodyEncoding = Encoding.Default MailMsg.Subject = MsgSubject MailMsg.Body = theOrder MailMsg.Priority = MailPriority.High MailMsg.IsBodyHtml = True MailMsg.From = New MailAddress("[email protected]", "Support at mydomain.com") MailMsg.To.Add(New MailAddress("[email protected]", "My Company Name")) MailMsg.CC.Add(New MailAddress(SenderEmail, SenderName)) 'Smtpclient to send the mail message Dim SmtpMail As New SmtpClient SmtpMail.Send(MailMsg) Any thoughts?
You're not accessing the settings specified in the web.config file. There's sample code here, here, and here.