| Dart Home | PowerTCP Mail for .NET | Custom Development | Reply | PowerTCP Mail for .NET Topics | Forums |
| Author | Forum: PowerTCP Mail for .NET Topic: Image with Content-ID gets delivered as attachment |
| dspkoester From: München, Germany Posts: 13 Member Since: 05/26/05 |
posted April 19, 2009 12:02 PM Hello, I'm trying to read a message that has been sent with the Activex- mail component using the latest .net trial version. I create a html-email with the ActiveX version using the Message.Addhtml method. In the html code is an image that gets converted to "cid:580119728". The image is added as message-part with the following header: ------=_NextPart_0000100f0003a707d9 Content-Type: image/jpeg; name="dsp640pix-schwach11_1.jpg" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="dsp640pix-schwach11_1.jpg" Content-ID: <580119728> When I then read this message with the .net version it is recognized as attachment (AttachmentStream), not as MessagePartStream. So I cannot get the contentID of the image. Reading this message with the ActiveX-version I get the content-ID. I think this a bug of the .net version. It should not read parts with a content-ID as attachment. Or is there another way to get the content-ID of an attachment? With regards Thomas |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted April 20, 2009 9:42 AM Hi Thomas, The part is specifically identified as an attachment, so it should be part of the Attachments collection. The ActiveX control may be better off not including a Content-Disposition header in the part, like Outlook Express does for this type of part. Regardless, you can get the Content-ID from the attachment, though I agree it could be more straightforward. I will put in a feature request for a ContentId property, but for now the code below should work. foreach (MimeAttachmentStream attachment in popMessage.Message.Attachments) { if (attachment.Header.Contains("Content-ID")) { int start = attachment.Header.IndexOf("Content-ID") + "Content-ID: ".Length; int length = attachment.Header.IndexOf("\r\n", start) - start; string cid = attachment.Header.Substring(start, length); } } Hope it helps, -ken ------ |
| dspkoester From: München, Germany Posts: 13 Member Since: 05/26/05 |
posted April 21, 2009 3:31 AM Hello Ken, thank you for the answer. Your code works fine. I did not see that there is an overload that delivers a MimeAttachmentStream. Thomas |
| Reply | PowerTCP Mail for .NET Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|