Results 1 to 7 of 7

Thread: Authentication is required for relay - mail error

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    469

    Authentication is required for relay - mail error

    Hello

    I am getting the following online error:

    Mailbox unavailable. The server response was: Authentication is required for relay
    I am using valid SMTP credentials provided by my Web hosting service, so I am unsure what extra authentication is required. Should the server people at my Web hosting service be providing that 'relay authentication'?

    Thank you

    Steve

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Authentication is required for relay - mail error

    Is the From address on a different domain?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    469

    Re: Authentication is required for relay - mail error

    No. The From address is from the domain that is hosted by my Web hosting service.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Authentication is required for relay - mail error

    Perhaps you should show us the code you're using.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Authentication is required for relay - mail error


  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    469

    Re: Authentication is required for relay - mail error

    Thanks jmcilhinney

    Here it is.

    Code:
    Dim myMessage As New MailMessage
                Dim Smtpserver As New SmtpClient          
                Dim strEmailValue As String = Request.Form("strEmailTextBox")
               
                'create the mail message
    
                myMessage.From = New MailAddress("info@myDomain.net") 'Webmaster's email
                myMessage.To.Add(New MailAddress("info@myDomain.net")) 'Webmaster's email
                myMessage.ReplyToList.Add(strEmailValue) 'user's email
                myMessage.Subject = ("Password Reset Request")
                myMessage.Body = "Please click on the following link to reset you password: <br/>Link<br/><br/>Thank you<br/>"
                myMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
                myMessage.IsBodyHtml = True
                myMessage.Priority = MailPriority.High
    
                Smtpserver.DeliveryMethod = SmtpDeliveryMethod.Network
                Smtpserver.Host = ("mail.server") 'Exact server name provided by Web hosting service
                Smtpserver.Port = 25
                Smtpserver.EnableSsl = False
    
                Dim basicAuthenticationInfo As New System.Net.NetworkCredential("info@myDomain.net", "SMTP_password_from_Hosting_Service")
    
                Smtpserver.Credentials = basicAuthenticationInfo
                Smtpserver.UseDefaultCredentials = False
                Smtpserver.Send(myMessage)
    
                myMessage.Dispose()
                myMessage = Nothing
                Smtpserver = Nothing
    
                'Text to tell user pwd reset link has been sent
    
                strEmailValue = Request.QueryString("strEmailValue")
    
                If strEmailValue IsNot Nothing Then
    
                    TextBox1.Text = String.Format("Your password reset link has been sent to {0}", strEmailValue)
    
                    TextBox1.Visible = True
                
               Else
    
                    TextBox1.Visible = False
    
                End If
    
            End If
    
        End Sub
    I will visit the link now. Thanks again.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    469

    Re: Authentication is required for relay - mail error

    Yes, it's easy to forget that 'true' in Web.config - http://stackoverflow.com/questions/2...ired-for-relay

    I have it set to 'true' when I have Visual Studio open, but change it to false when compiling and uploading the pages.

Posting Permissions

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



Click Here to Expand Forum to Full Width