How to send base64 attachment with SendMsg

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
Post Reply
zorogat
Posts: 2
Joined: Thu Aug 09, 2018 3:48 pm

How to send base64 attachment with SendMsg

Post by zorogat »

Hello,
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>
  <mp ct='image/png;name="logo.png"'><content>iVBORw0KGgoAAAANSUhEUgAAAAoAAAAUCAYAAAC07qxWAAAABHNCSVQICAgIfAhkiAAAAAZiS0dEAP8A/wD/oL2nkwAAAKRJREFUKJHtkL0NwkAMhZ9NemASWIENGAUJpQGFcMWVkcIIjMAGGSUjQIs4PwoUdCSBIGpeZ/vz84+gR/kmnd/EJk3sfVElMZBt13uIrigYj6BxSZIYEtW8bwKAqE1l+Q4CgKejQGavJZ6CseyAbQVj6X1RdUcPSHZZykFIr9OvHJ07nAdBEhcASGjmHvatH5JHkjVUawCQJt/eNZgtfrr6D37UHRhyNADGMeqzAAAAAElFTkSuQmCC</content>
  </mp>
</mp>
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!
phoenix
Ambassador
Ambassador
Posts: 27272
Joined: Fri Sep 12, 2014 9:56 pm
Location: Liverpool, England

Re: How to send base64 attachment with SendMsg

Post 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:

https://stackoverflow.com/questions/911 ... signatures
https://stackoverflow.com/questions/911 ... 64#9110164
Regards

Bill

Rspamd: A high performance spamassassin replacement

Per ardua ad astra
zorogat
Posts: 2
Joined: Thu Aug 09, 2018 3:48 pm

Re: How to send base64 attachment with SendMsg

Post 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.
Post Reply