Mandrill binary attachment

Jun 1, 2013 at 5:09 PM
Do we have to base64 encode a binary attachment as the Attachment only takes a string as the content.

Thanks,

Roy
Coordinator
Jun 1, 2013 at 10:48 PM
You need to supply a base64 encoded string unless you choose to create an attachment using static member Attachment.Create(...)
Jun 2, 2013 at 2:49 AM
Thanks, I'll try the static method. I've tried adding text attachments and setting the binary parameater to false and the attachments are coming across as zero bytes. I can debug it and see that I am definitely passing a value to the content. Is that intent of the binary parameter - to be able to attach a string attachment by setting it to false.
Coordinator
Jun 2, 2013 at 5:56 AM
Edited Jun 2, 2013 at 5:59 AM
Oh, I see. It's confusing :)
"Binary" field is not used during serialization (request). It serves "messages/parse" calls only. Mandrill service requires binary encoded attachment. Any string value results in gibberish.

In any case, if you set a raw string value, call .ToBinary() method before sending.
Jun 2, 2013 at 2:05 PM
Thanks. Got it working by encoding it to a byte array and then base64 encoding it.