Page 1 of 1

How to send base64 attachment with SendMsg

Posted: Thu Aug 09, 2018 3:57 pm
by zorogat
I have searched the forum but i could not find an answer on how to send an email using the SendMsg function, with a base64 encoded attachment. The problem is that Zimbra server is encoding the string I am sending and returning it in base64 format, hence garbling the image.
For example:

Code: Select all

<mp ct="multipart/related">
  <mp ct="text/plain">
    <content>email body</content>
  <mp ct='image/png;name="logo.png"'><content>iVBORw0KGgoAAAANSUhEUgAAAAoAAAAUCAYAAAC07qxWAAAABHNCSVQICAgIfAhkiAAAAAZiS0dEAP8A/wD/oL2nkwAAAKRJREFUKJHtkL0NwkAMhZ9NemASWIENGAUJpQGFcMWVkcIIjMAGGSUjQIs4PwoUdCSBIGpeZ/vz84+gR/kmnd/EJk3sfVElMZBt13uIrigYj6BxSZIYEtW8bwKAqE1l+Q4CgKejQGavJZ6CseyAbQVj6X1RdUcPSHZZykFIr9OvHJ07nAdBEhcASGjmHvatH5JHkjVUawCQJt/eNZgtfrr6D37UHRhyNADGMeqzAAAAAElFTkSuQmCC</content>

My content for the image is already encoded, but then ZImbra server is encoding my already encoded content for the second time... how to prevent this behaviour?
Thank you for anyone who can help!

Re: How to send base64 attachment with SendMsg

Posted: Fri Aug 10, 2018 3:44 pm
by phoenix
AFAIK, the image should be embedded as an attachment and ZCS will convert that to base64 I also don't think you can disable that (but I'm often wrong :)). See the comments here and check if they're relevant to you: ... signatures ... 64#9110164

Re: How to send base64 attachment with SendMsg

Posted: Fri Aug 10, 2018 4:16 pm
by zorogat
Hi Phoenix, first of all thank you for your answer.
Unluckily, I need to send files that have already been encoded with base64 format.
The image should be sent as an attachment and not inside the HTML code as in your link.. ideally I would need to change the following header:
Content-Transfer-Encoding: base64
but only for the interested message part (mp).
For example if I try and add <header name='Content-Transfer-Encoding'>base64</header>, Zimbra server will answer with an error (invalid request: header 'Content-Transfer-Encoding' not allowed").
I can't find any solution for the problem, which seems a bit odd for an email server.