0

I am using Mandrill App to send emails from my android application. I am trying to send emails with attachment. But I am unable to send attachments. As per requirement I have converted image file and text file into base64 string and passed to json object of mandrill api. But still mail goes without attachment. I referred this link to convert image file to into base64. I also want to attach Doc, Ppts, Pdfs to attachment. If anyone knows please guide me.

Community
  • 1
  • 1
Sanket Ranaware
  • 593
  • 1
  • 5
  • 13
  • Did you see this? http://thenextweb.com/dd/2016/02/25/in-hostile-move-mandrill-gives-all-developers-60-days-to-switch-to-paid-mailchimp-service/ – Yepher Feb 25 '16 at 16:59

1 Answers1

0

Looking at this link you will need to fill in the the Attachments Array. Here is the relevant JSON part:

"attachments": [
        {
            "type": "text/plain",
            "name": "myfile.txt",
            "content": "ZXhhbXBsZSBmaWxl"
        }
    ],

Other services like SparkPost also provide an easy way to do this too. The reason I bring up SparkPost is this post from Mandrill CEO: http://blog.mailchimp.com/important-changes-to-mandrill/

Yepher
  • 1,279
  • 11
  • 24
  • Actually I I have added all the contents of this array. Now Image file is going as attachment but it is received as damaged image. – Sanket Ranaware Feb 27 '16 at 09:23
  • If you base64 decode the `content` field is it a good file. Try on the output and on the receive side. Beware not to take binary through UTF8 or something like that . You will want the raw bytes. – Yepher Feb 28 '16 at 14:34
  • Actually I am not decoding it at receiver side, Receiver side is any mail client or site like gmail, yahoo or outlook @Yepher – Sanket Ranaware Feb 29 '16 at 10:22
  • Sorry, I was just thinking about a test too see where it goes wrong. My suspicion is that the sending side base64 encoding it not correct. At least that is where I've got bit before. – Yepher Feb 29 '16 at 13:43