Results 1 to 4 of 4

Thread: Sending Email

  1. #1
    Join Date
    Sep 2011
    Posts
    2

    Question Sending Email

    I'm trying to send an email from asp.net 4.0 and all i get is an error saying :- ERROR Failure sending mail. I am using the below code, some of which taken from another thread.

    Dim msg As MailMessage = New MailMessage()
    Dim smtp As New SmtpClient("smtp.mydomain.com")

    msg.From = New MailAddress(strFromAddress, strFromUser)
    msg.To.Add(New MailAddress(strEmailAddress, strRecipient))
    msg.IsBodyHtml = False
    msg.Subject = ""
    msg.Body = ""

    Dim credLogin As System.Net.NetworkCredential = New System.Net.NetworkCredential("Do-Not-Reply@mydomain.com", "mypassword")

    smtp.Credentials = credLogin
    smtp.Send(msg)

    Does anyone know what I am doing wrong and what the error is. I've set up the from email address.

  2. #2
    Join Date
    Mar 2010
    Location
    OMG!! I am LOST..
    Posts
    161

    Default

    Hi Nigel,

    On our shared servers we have authentication set for sending emails through script.

    It seems you are using smtp.mydomain.com, can you try using server name as the servers IP or mail.domain.tld ?

    If you are trying to send emails from scripts , then you need to check the following points in your script :

    1) SMTP HOST = mail.domain.tld or (mail server ip)

    2) From Field email address = the one that is created from your control panel, and present there

    3) Password = its respective password

    4) Port = 25

    This is to be verified as we have authentication set for the emails.

    If the error persist even after using mail.domain.tld, I will suggest you to raise a support ticket or initiate a live chat with windows department
    or else PM me the details of the domain and script location, we investigate this for you.
    Chris White
    eUKHost
    UK's premier web hosting company.

  3. #3
    Join Date
    Sep 2011
    Posts
    2

    Default

    Issue sorted now, thanks Chris...

    I guess f32/send-email-asp-net-2302/ need updatin as thats where i was getting my information from.

    What was wrong, i was using smtp.mydomain.com instead of mail.mydomain.com and wasn't setting the port.

  4. #4
    Join Date
    Mar 2010
    Location
    OMG!! I am LOST..
    Posts
    161

    Default

    Quote Originally Posted by EnjayW View Post
    Issue sorted now, thanks Chris...

    I guess f32/send-email-asp-net-2302/ need updatin as thats where i was getting my information from.

    What was wrong, i was using smtp.mydomain.com instead of mail.mydomain.com and wasn't setting the port.
    Hi Nigel,

    No worries, I'm glad to hear that the issue has been sorted.
    Chris White
    eUKHost
    UK's premier web hosting company.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •