Bug 2279 - System.Net.Mail.AlternateView.ContentID does not write ContentID header to e-mail
Summary: System.Net.Mail.AlternateView.ContentID does not write ContentID header to e-...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Martin Baulig
URL:
Depends on:
Blocks:
 
Reported: 2011-11-30 17:00 UTC by tcoop3
Modified: 2016-11-11 09:53 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Possible patch to SmtpClient (1.46 KB, patch)
2011-12-01 10:01 UTC, tcoop3
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description tcoop3 2011-11-30 17:00:14 UTC
Running openSuSE 11.4 with Mono 2.10.6. I'm writing a C# library that (among other things) creates multipart MIME e-mails.

On the .NET Framework 2.0, it's possible to use this code:

MailMessage m = new MailMessage(ctor parameters);
AlternateView av = new AlternateView(ctor parameters);
av.ContentID = "some_uid";
m.AlternateViews.Add(av);

...to produce mail headers like this in that particular part of the message:
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
Content-ID: <some_uid>

On Mono, I'm able to set Content-Transfer-Encoding (using av.Transfer-Encoding) and Content-Type (through the constructor) and have them come out successfully in the headers. However, the Content-ID header isn't written out in the e-mail as it is on the MS Framework 2.0.
Comment 1 tcoop3 2011-12-01 10:01:34 UTC
Created attachment 981 [details]
Possible patch to SmtpClient

The bug appears to be in System.Net.Mail.SmtpClient. There are several "StartSection" methods; the one used to send AlternateViews only passed in the Content-Type and Content-Transfer-Encoding fields. This fix works the same way as sending a LinkedResource does - the object gets passed in, and if a Content-ID has been specified, it is written out to the message.

Can't be 100% certain this works (don't have a build environment for Mono set up at the moment), but the SmtpClient class does at least compile cleanly.
Comment 2 Shay Rojansky 2012-10-28 20:31:38 UTC
The same issue was occuring with the Attachment class, not just AlternateView.

I've just submitted a pull request for this: https://github.com/mono/mono/pull/488
Comment 3 Shay Rojansky 2013-03-12 18:27:48 UTC
The pull request fixing this has been merged some time ago, can you try to reproduce this etc?
Comment 4 Shay Rojansky 2014-11-04 06:00:08 UTC
I'm pretty sure this issue can be closed, the fix was merged quite some time ago
Comment 5 Martin Baulig 2016-11-11 09:53:02 UTC
Closing ancient bugs, please reopen if you're still having this problem.