4

When you send an email using System.Net.Mail you can set the SMTP MAIL FROM envelope by using the MailMessage.Sender Property.

If you set the smtp network deliveryMethod property to be "Network", the MAIL FROM envelope is set using the Sender value.

If you set the smtp network deliveryMethod property to be "PickupDirectoryFromIis", the MAIL FROM envelope uses the MailMessage.From property instead of the Sender one.

I need to keep PickupDirectoryFromIis as my deliveryMethod for performance concern.

Any suggestion how to keep the value I need for the SMTP MAIL FROM envelope?

Thanks in advance.

Coral Doe
  • 1,925
  • 3
  • 19
  • 36
Romhein
  • 2,126
  • 2
  • 17
  • 17
  • http://social.msdn.microsoft.com/Forums/en-US/ncl/thread/a26c273a-18eb-4143-8631-233088977b21/ – bzlm Mar 16 '09 at 22:32
  • Thanks, but I asked this question on the msdn :) – Romhein Mar 17 '09 at 14:46
  • http://stackoverflow.com/questions/464876/sending-an-email-with-the-header-return-path-using-windows-virtual-mail-server/480381#480381 – bzlm May 04 '09 at 08:22

2 Answers2

2

What about if you use:

  <smtp deliveryMethod="SpecifiedPickupDirectory" from="me@mydomain.com">
    <specifiedPickupDirectory pickupDirectoryLocation="c:\Temp\Mail" />
  </smtp>

??

Eduardo Molteni
  • 38,786
  • 23
  • 141
  • 206
1

Reported as a bug: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=483878

Richard Deeming
  • 29,830
  • 10
  • 79
  • 151
  • 1
    The bug report has just been updated: "Fix will appear in a future release of the .Net framework." – Richard Deeming Sep 22 '09 at 11:06
  • Thanks for the info; the "appear in a future release" does not sound like we are going to have the fix soon :( – Romhein Sep 22 '09 at 13:59
  • I've just tested this in .NET 4.0 RTM, and it looks like it's fixed. Shame they couldn't fix it for 3.5, but I guess they're too busy playing with the new toys to worry about "old" framework versions. – Richard Deeming Aug 03 '10 at 17:53