Winhost to Hotmail - System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable

Discussion in 'Email' started by Evado, Oct 27, 2015.

  1. 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: <theEmail@hotmail.com> 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 support@mydomain.com, 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="support@mydomainname.com">
    <networkhost="mail.mydomainname.com"password="mypa$$w0rd"
    userName="support@mydomainname.com"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("support@mydomainname.com", "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.
     
  2. FredC

    FredC Winhost Staff

    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.
     
  3. 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="support@mydomain.com">
    <network host="mail.mydomain.com" password="myPas$w0rd" port="25"
    userName="support@mydomain.com" 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("support@mydomain.com", "Support at mydomain.com")
    MailMsg.To.Add(New MailAddress("support@mydomain.com", "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?
     
  4. Elshadriel

    Elshadriel Winhost Staff

    You're not accessing the settings specified in the web.config file. There's sample code here, here, and here.
     
    Michael likes this.

Share This Page