<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>crunchlife: System.Net.Mail.SmtpFailedRecipientException and Exchange 2007</title>
    <link>http://crunchlife.com/articles/2009/01/30/system-net-mail-smtpfailedrecipientexception-and-exchange-2007</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>System.Net.Mail.SmtpFailedRecipientException and Exchange 2007</title>
      <description>&lt;p&gt;I&amp;#8217;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 &lt;a href="http://stackoverflow.com/questions/444210/how-do-i-send-emails-outside-my-domain-with-exchange-2007-and-c" target="_blank"&gt;a workaround&lt;/a&gt; that uses the Exchange 2007 Pickup folder.  This eliminated my authentication hassles and resolved the dreaded &lt;strong&gt;Mailbox unavailable. The server response was: 5.7.1 Unable to relay&lt;/strong&gt; error.  I&amp;#8217;ve posted the solution here, but I also suggest reading &lt;a href="http://stackoverflow.com/questions/444210/how-do-i-send-emails-outside-my-domain-with-exchange-2007-and-c" target="_blank"&gt;the original post&lt;/a&gt;.&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;SmtpClient smtpClient = new SmtpClient(&amp;quot;EXCHANGESRV&amp;quot;, 25) {
    DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory,
    PickupDirectoryLocation = &amp;quot;\\EXCHANGESRV\PickupFolder&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Keep in mind that you&amp;#8217;ll either need sufficient write permission on the Pickup folder or be able to impersonate somebody that does.  I happen to have &lt;a href="http://crunchlife.com/articles/2008/05/27/temporary-identity-impersonation-in-asp-net" target="_blank"&gt;written about identity impersonation&lt;/a&gt; a few months ago.  You&amp;#8217;re in luck.&lt;/p&gt;

&lt;p&gt;Kudos to &lt;a href="http://stackoverflow.com/" target="_blank"&gt;stackoverflow.com&lt;/a&gt;.  I only wish I had enough rep to upvote the submitter. :(&lt;/p&gt;</description>
      <pubDate>Fri, 30 Jan 2009 09:45:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:732e970b-8123-45a8-90e6-214f6938c382</guid>
      <author>Ryan Baxter</author>
      <link>http://crunchlife.com/articles/2009/01/30/system-net-mail-smtpfailedrecipientexception-and-exchange-2007</link>
      <category>Code Snippets</category>
      <category>Expect the Unexpected</category>
      <category>dotNET</category>
      <category>Oops</category>
    </item>
    <item>
      <title>"System.Net.Mail.SmtpFailedRecipientException and Exchange 2007" by Ryan Baxter</title>
      <description>I agree, but sometimes doing things the "best" way is outside of your control.  It happens to all of us.  Like I said, it's a workaround.</description>
      <pubDate>Tue, 20 Oct 2009 07:34:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:ea344b62-721b-4fb2-b7d1-94ab507d5d83</guid>
      <link>http://crunchlife.com/articles/2009/01/30/system-net-mail-smtpfailedrecipientexception-and-exchange-2007#comment-30118</link>
    </item>
    <item>
      <title>"System.Net.Mail.SmtpFailedRecipientException and Exchange 2007" by Edwin</title>
      <description>This is not so good. The best thing is to change the SMPT server to relay emails from authenticated server or users.</description>
      <pubDate>Tue, 20 Oct 2009 07:21:23 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:a229d238-1dd7-43f0-826c-2eef9a5fac94</guid>
      <link>http://crunchlife.com/articles/2009/01/30/system-net-mail-smtpfailedrecipientexception-and-exchange-2007#comment-30117</link>
    </item>
  </channel>
</rss>
