Mandrill binary attachment

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

Thanks,

Roy
Jun 1, 2013 at 11: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 3: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.
Jun 2, 2013 at 6:56 AM
Edited Jun 2, 2013 at 6: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 3:05 PM
Thanks. Got it working by encoding it to a byte array and then base64 encoding it.