So I have this very basic program that is trying to send an e-mail, but I keep getting
Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender
Here is my program
static void Main(string[] args)
{
SmtpClient client = new SmtpClient("Server", 25);
client.UseDefaultCredentials = false;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Credentials = new NetworkCredential("UserName", "Password");
client.Send(new MailMessage("[email protected]","Recipient"));
}
I know the credentials work, if I run SMTP Test Tool 3.0 with the same data everything works great.
Here is some screen shots on a receive connector set up for my IP on the exchange server
Anybody have any ideas what would be causing this error in my code, but not within the simple SMTP testing tool? Am I missing some kind of authentication option somewhere? I have quadruple checked all the information is correct and identical in both places and it works in the tool but not in the code.
You might see this error if: You don't have permission to send to the recipient. You don't have permission to send to the distribution group or subgroups. You don't have permission to send email through an email server that's between you and the recipient. Your message was routed to the wrong email server.
I found the problem, I needed to check the box 'Accept any sender' for authenticated users.
More information here: http://technet.microsoft.com/en-us/library/aa997170(EXCHG.140).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With