Link to home
Start Free TrialLog in
Avatar of BobBarker_99
BobBarker_99

asked on

Mailbox unavailable. The server response was: 5.7.1 Unable to relay

I'm getting the above error message. My code is posted below.  The code below has worked fine for several months.

This last week, I started getting the error message stated in the title of the question.  
The mailserver and the website are hosted on 2 different servers.  

Anyone know why this has stopped working?  How I can fix it?

Thanks
Dim mail As New MailMessage
Dim fromAddress As New MailAddress("me@mydomain.com")
mail.From = fromAddress 
mail.To.Add("towherever@gmail.com")
mail.Subject = "blah"
mail.Body = "123, abc"

Dim mailClient As String = "myMailServer.com"
Dim smtp As New SmtpClient(mailClient)

Open in new window

Avatar of BobBarker_99
BobBarker_99

ASKER

Oh, missing the last line...

smtp.Send(mail)
ASKER CERTIFIED SOLUTION
Avatar of tigermatt
tigermatt
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I had tech services setup the recieve connector, and had them add the servers IP address.

My code is the same, except that I now also use authentication.
Dim myCred As new NetworkCredential("myLogin", "myPass")
smtp.Credentials = myCred
smtp.Send

I now get the following exception:
Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial