Adding html disclaimer to outgoing mail, with header and footer

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
Alex0365
Posts: 2
Joined: Tue Jul 23, 2019 4:15 pm

Adding html disclaimer to outgoing mail, with header and footer

Postby Alex0365 » Wed Jul 24, 2019 12:15 pm

Hi Everyone,

I asked this question here, https://www.reddit.com/r/Zimbra/comment ... h=66798cb5 :

I'm completely new to zimbra, but I wondering if there's a feature where you can have all outgoing emails sent through, injecting some arbitrary disclaimer/verbiage/html into the emails? I'm essentially trying to use this to add branding to all outgoing emails: write some email, hit send, rule on the server injects some html into the top of the emails and the bottom, with the content that was sent, sandwiched in between. Essentially, the way you're do it in exchange with https://docs.microsoft.com/en-us/exchan ... erver-2019

And as mentioned there, i'm trying to get this result:

Code: Select all

<html>
<head></head>
<body>
<h1>My static, auto injected company name </h1>
<p>{ORIGINAL_MESSAGE}</p>
<p>My company's static, auto injected signature/disclaimer</p>
</body></html>


And one of the replies was to "add a filter to Zimbra's Postfix instance"...could someone help me with some rudimentary steps on how to do that?



Update: I installed a docker image of Zimbra, locally via https://wiki.zimbra.com/wiki/Deploy_Zim ... ing_docker and using https://wiki.zimbra.com/wiki/New_Featur ... er_support i was able to add a footer disclaimer. So, halfway there. However, i still need the top part, and in looking at the source code of altermime (https://github.com/inflex/alterMIME/blo ... ltermime.c ) there's options for

Code: Select all

#ifdef ALTERMIME_PRETEXT
/*"   [--pretext] Insert disclaimer files in pretext mode.\n"*/ // By implication, pretext is inserted based on the file status below.
"   [--pretext=<pretext file>]\n"
"   [--pretext-html=<pretext HTML file>]\n"
"   [--pretext-b64=<BASE64 encoded pretext >]\n"
#endif


And i tried modifying /opt/zimbra/conf/amavisd.conf to add those args, but it doesnt seem to be kicking in....does anyone know if that's the file i should be touching, to update the calls in the pipeline to altermime?

Update 2: As suggested here https://www.reddit.com/r/Zimbra/comment ... h=318fca16 i've made the following changes and it's somewhat working, minus the weird base64 side effect:

I found /opt/zimbra/conf/amavisd.conf.in and changed it to


Code: Select all

%%uncomment VAR:zimbraDomainMandatoryMailSignatureEnabled%%@altermime_args_disclaimer = qw(--verbose --disclaimer-b64=/opt/zimbra/data/altermime/_OPTION_.b64 --disclaimer=/opt/zimbra/data/altermime/_OPTION_.txt --disclaimer-html=/opt/zimbra/data/altermime/_OPTION_.html --pretext=/opt/zimbra/data/altermime/_OPTION_.txt --pretext-html=/opt/zimbra/data/altermime/_OPTION_.html --pretext-b64=/opt/zimbra/data/altermime/_OPTION_.b64 );


however, funny enough, it seems to be using the base64 version of the option (_OPTION_.b64 where obviously, _OPTION_.b64 is the file named after my domain name), to inject the raw contents (base64 string) into the html version of the message....


but, with this change, calling zmamavisdctl restart actually enacts the change, and i can at least see the .b64 file's contents, in the sample emails i send out, at the top of the message. Maybe im just flapping my gums in the wind, but if nothing else, i'm hoping someone in the future can find some use in this.

Final update: SUCCESS just had to remove the --pretext-b64 argument (which i think was just there in the github link for an altermime fork, and not the actual source code)



Code: Select all

%%uncomment VAR:zimbraDomainMandatoryMailSignatureEnabled%%@altermime_args_disclaimer = qw(--verbose --disclaimer-b64=/opt/zimbra/data/altermime/_OPTION_.b64 --disclaimer=/opt/zimbra/data/altermime/_OPTION_.txt --disclaimer-html=/opt/zimbra/data/altermime/_OPTION_.html --pretext=/opt/zimbra/data/altermime/_OPTION_header.txt --pretext-html=/opt/zimbra/data/altermime/_OPTION_header.html );
 


I now get exactly what i wanted. Putting my header stuff inside /opt/zimbra/data/altermime/_OPTION_header.html where _OPTION_ is the domain name. Hope this helps someone in the future!


User avatar
gabrieles
Advanced member
Advanced member
Posts: 106
Joined: Tue Feb 14, 2017 9:40 am

Re: Adding html disclaimer to outgoing mail, with header and footer

Postby gabrieles » Tue Jul 30, 2019 1:52 pm

You've gone a little overkill

https://wiki.zimbra.com/wiki/Steps_to_c ... r_versions

zmprov mcf zimbraDomainMandatoryMailSignatureEnabled TRUE
zmprov md mydomain.tld zimbraAmavisDomainDisclaimerText "my text disclamer"
zmprov md mydomain.tld zimbraAmavisDomainDisclaimerHTML "<html><body><h1>my html disclaimer on one line </h1><br> <h1>First and Second Name </h1><br>Other data...</body></html>"
/opt/zimbra/libexex/zmaltermimeconfig -e mydomain.tld

This will create and mantain the three files under /opt/zimbra/data/altermime, that in other case can be deleted every time you restart the amavis service.
Alex0365
Posts: 2
Joined: Tue Jul 23, 2019 4:15 pm

Re: Adding html disclaimer to outgoing mail, with header and footer

Postby Alex0365 » Tue Jul 30, 2019 2:47 pm

gabrieles wrote:You've gone a little overkill

https://wiki.zimbra.com/wiki/Steps_to_c ... r_versions

zmprov mcf zimbraDomainMandatoryMailSignatureEnabled TRUE
zmprov md mydomain.tld zimbraAmavisDomainDisclaimerText "my text disclamer"
zmprov md mydomain.tld zimbraAmavisDomainDisclaimerHTML "<html><body><h1>my html disclaimer on one line </h1><br> <h1>First and Second Name </h1><br>Other data...</body></html>"
/opt/zimbra/libexex/zmaltermimeconfig -e mydomain.tld

This will create and mantain the three files under /opt/zimbra/data/altermime, that in other case can be deleted every time you restart the amavis service.



the 3 files are the text version, html version, and base64 version of just the footer disclaimer, right? That won't add my header disclaimer, will it?

Return to “Developers”

Who is online

Users browsing this forum: No registered users and 1 guest