Receive Email Attachment - ContentDataText issue

Receive Email Attachment - ContentDataText issue

  

Hi,

I am received emails from G Mail along with attachment using S22_Imap.i can get the Attachment name,content id and content type properties values except attachment body. ContentDatatext attribute value as  ""(Empty) and ContentDatabinary attribute value as "BinaryData (0 bytes)".

Hi Ganesh,

Iirc, you must explicitly specify when retrieving a message that you also want to retrieve the body of attachments.

Kilian Hekhuis wrote:

can you elaborate more how we can define explicitly to get an attachment body.

My scenario:i am going to insert the body values(message) into database. ContentDatatext attribute values are getting from static entity and get those values then insert into my db.

Hi Ganesh,

Iirc, you must explicitly specify when retrieving a message that you also want to retrieve the body of attachments.



Hi Ganesh,

I mixed up GetMessage (which I presume you used) with GetMessagePartial. However, when checking the Attachment Structure, this is what the description says:

Represents an email message's attachment or an alternate format of an email message. This is a mapping of both .NET's System.Net.Mail.Attachment and System.Net.Mail.AlternateView. This is used with S22_Imap only, and so it's missing the *Encoding and *TransferEncoding properties and all corresponding properties are already decoded into UTF-8 (e.g.: ContentStream is decoded and there is no TransferEncoding).

The Attachment structure contains a ContentStreamId that should be used with GetAttachmentStream to get the attachment's data. Its ContentData* attributes are used only with StoreMessage*.

Did you see this? Did you use GetAttachmentStream()?