System.Net.Mail.SmtpFailedRecipientException and Exchange 2007
Posted by Ryan Baxter Fri, 30 Jan 2009 17:45:00 GMT
I’d recently been struggling with a .NET application that sends email via SMTP through Exchange 2007 outside of my domain at work. That is, until I found a workaround that uses the Exchange 2007 Pickup folder. This eliminated my authentication hassles and resolved the dreaded Mailbox unavailable. The server response was: 5.7.1 Unable to relay error. I’ve posted the solution here, but I also suggest reading the original post.
SmtpClient smtpClient = new SmtpClient("EXCHANGESRV", 25) {
DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory,
PickupDirectoryLocation = "\\EXCHANGESRV\PickupFolder"
}
Keep in mind that you’ll either need sufficient write permission on the Pickup folder or be able to impersonate somebody that does. I happen to have written about identity impersonation a few months ago. You’re in luck.
Kudos to stackoverflow.com. I only wish I had enough rep to upvote the submitter. :(
- Posted in Code Snippets, Expect the Unexpected
- Meta 2 comments, permalink, rss, atom
Comments
9 months later:
9 months later:

