ContentDisposition.FileName should be changed and not Name property of
Sorry, wrong answer. The Name property of the System.Net.Mail.Attachment
class sets the value of the "name" parameter of the Content-Type header for
the Attachment. This is used by the Attachment class to create the header. I
have been running a service that sends emails using the System.Net.Mail
namespace classes for over a year now, and use the Name property of the
Attachment to set the file name. The Attachments are actually created from
strings, not files, and the Name property sets the file name that is sent to
the client.
The following is an excerpt from the header of one of these emails, each of
which includes multiple attachments:
----boundary_30_1d665342-2ec3-494e-9c20-acc8d3b1df7f
Content-Type: text/plain;
name="AWOS Client Report for KCGE 10-30-2006.txt"
Content-Transfer-Encoding: base64
----boundary_30_1d665342-2ec3-494e-9c20-acc8d3b1df7f
Content-Type: text/plain;
name="AWOS Client Report for KCGS 10-30-2006.txt"
Content-Transfer-Encoding: base64
----boundary_30_1d665342-2ec3-494e-9c20-acc8d3b1df7f
Content-Type: text/plain;
name="AWOS Client Report for KESN 10-30-2006.txt"
Content-Transfer-Encoding: base64
----boundary_30_1d665342-2ec3-494e-9c20-acc8d3b1df7f
Content-Type: text/plain;
name="AWOS Client Report for KFDK 10-30-2006.txt"
Content-Transfer-Encoding: base64
----boundary_30_1d665342-2ec3-494e-9c20-acc8d3b1df7f
Content-Type: text/plain;
name="AWOS Client Report for KFME 10-30-2006.txt"
Content-Transfer-Encoding: base64
----boundary_30_1d665342-2ec3-494e-9c20-acc8d3b1df7f
Content-Type: text/plain;
name="AWOS Client Report for KRJD 10-30-2006.txt"
Content-Transfer-Encoding: base64
----boundary_30_1d665342-2ec3-494e-9c20-acc8d3b1df7f
Content-Type: text/plain;
name="AWOS Client Report for KW29 10-30-2006.txt"
Content-Transfer-Encoding: base64
----boundary_30_1d665342-2ec3-494e-9c20-acc8d3b1df7f
Content-Type: text/plain;
name="AWOS Client Report for K2G4 10-30-2006.txt"
Content-Transfer-Encoding: base64
----boundary_30_1d665342-2ec3-494e-9c20-acc8d3b1df7f
Content-Type: text/plain;
name="AWOS Client Report for KCBE 10-30-2006.txt"
Content-Transfer-Encoding: base64
----boundary_30_1d665342-2ec3-494e-9c20-acc8d3b1df7f
Content-Type: text/plain;
name="DSI AWOS Services Distribution Report for 10/30/2006 3:45:56 AM.txt"
Content-Transfer-Encoding: base64
--
HTH,
Kevin Spencer
Microsoft MVP
Short Order Coder
http://unclechutney.blogspot.com
The devil is in the yada yada yada