Why to show email signature image as an attachment to the email

Oct 8, 2012 at 1:14 AM

Hey Guys, Just wondering that why do we need to show email signature image as an attachment to the email? Is not it the part of main email message itself?

Is this an issue or this is how pstsdk works? I am not sure.

Oct 8, 2012 at 1:51 AM

This is a pretty good question.  There is a reason, and it actually stems from SMTP, which is how majority of email is transmitted across the internet.  This is how the RFC standard for emails is designed, where non-text data would be added as a separate part in the email as an attachment.

If you were to ever look at an EML (which is essentially a raw RFC email), you may notice that an email opened with a program, for example Outlook, may display an image inside of the body of the message, but looking at the raw text would reveal that it is actually an attachment to the email.  So, how does a program like Outlook know that the image should be rendered inline of the message and not as an actually attachment?  There is a "Content-Disposition" header that specifies if the data should be "inline" or "attachment".  An additional header "Content-ID" is a unique id for the item, and inside of the body of the email.  The email program knows where to show the image when it finds "cid:" followed by a valid Content-ID in the html body of the message.

Likewise, PSTs follow the same behavior.  To determine if an attachment should be displayed inline, you need to do the following:

  1. Make sure attRenderedInBody (0x4) flag in the PidTagAttachFlags (0x3714) property is set to 1
  2. Make sure the PidTagAttachContentId (0x3712) property has a value.  (The PidTagAttachContentLocation property can also be used but is not recommended)
  3. (optional, but recommended) Verify that a URI that has the value "cid:" followed by the value from PidTagAttachContentId property is used somewhere in the HTML body.