How to send base64 attachment with SendMsg

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

How to send base64 attachment with SendMsg

Postby zorogat » Thu Aug 09, 2018 3:57 pm

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: 25702
Joined: Fri Sep 12, 2014 9:56 pm

Re: How to send base64 attachment with SendMsg

Postby phoenix » Fri Aug 10, 2018 3:44 pm

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

If you'd like to see this implemented in a future version of ZCS then please vote on Bugzilla entries 97706 & 108168
zorogat
Posts: 2
Joined: Thu Aug 09, 2018 3:48 pm

Re: How to send base64 attachment with SendMsg

Postby zorogat » Fri Aug 10, 2018 4:16 pm

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.

Return to “Developers”

Who is online

Users browsing this forum: No registered users and 9 guests