mailcow / mailcow-dockerized

mailcow: dockerized - 🐮 + 🐋 = 💕
https://mailcow.email
GNU General Public License v3.0
8.94k stars 1.17k forks source link

Domain-wide disclaimer. #1485

Closed ayushin closed 1 year ago

ayushin commented 6 years ago

How difficult would it be to implement domain-wide disclaimers (signatures)?

What would be the right way to do it?

I suppose we need a "disclaimer" field per domain in the mysql database and then auto-generate config file for some additional milter (altermime?)

andryyy commented 6 years ago

Hi, Rspamd will provide this feature probably in the near future. At least we can add/modify mime content. Altermime is not a milter and will break DKIM by changing the content after signing. We could also write our own milter for that. Besides that we COULD implement a second pre-smtpd with Altermime. But I don’t like that idea. It would require multiple changes like another Rspamd listener for just rate limits and stuff like that.

ayushin commented 6 years ago

@andryyy Thanks for the feedback. I am not intimately familiar with the milters, but I suppose its not a rocket science, so if you give me a pointer in the right direction I would be happy to code it in python.

So I just write a python milter, that would connect to the mailcow mysql database, look up the domain and the address (I guess we would need a flag to either add disclaimer to all the addresses or only those with a tick) and then add that disclaimer to the message.

Where in the pipeline should we call that milter? Is that smtpd content-milter?

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

deanroker123 commented 6 years ago

I have a requirement to be able to do this as well. Any ideas if or when it would be possible?

iammattmartin commented 4 years ago

@patschi I'd be interested in putting in for the future. Being able to add signatures on a per domain, or even per email address basis to ensure correct/uniform signatures would be great!

codiflow commented 4 years ago

Hey together,

I've seen that rspamd has already implemented a function to do this way back in 2019 with version 1.9 of rspamd: https://rspamd.com/announce/2019/03/12/rspamd-1.9.0.html

Mailcow actually ships with version 2.5 of rspamd so this tool is widely available. You can check this using the following command: docker-compose exec rspamd-mailcow rspamadm mime modify -h

Since I don't know my way around well enough in hacking the config of rspamd or other mailcow components maybe someone of you does?

How can I process my outgoing mails as files to this rspamadm tool to get several disclaimers applied depending on their source domain?

Regards Christian

andryyy commented 4 years ago

I think there is no way to do it via API.

Schmandre commented 4 years ago

Hello,

Iam also interested to use a domain wide disclaimer as signature. Any new informations/tutorials etc. here? ;)

Regards Schmandre

LeonDelacroixe commented 4 years ago

I am also interested, is this generally planned

bacanol commented 3 years ago

It would be very interesting for our implementation as well.

PiotrEsse commented 3 years ago

I also think it would be great. Regards, Piotr

PiotrEsse commented 3 years ago

Super. Zieht ihr die denn dann bzw. rechnet den Aufwand gegen die ab oder wie läuft das?

If I understand You correctly this could be implemented in few ways.

Ie. We can add separate option for domain manager so he can add unified signature for all emails in specific domain.

andryyy commented 3 years ago

Haha, sorry, I responded to the wrong mail... :) Ignore it, please. I deleted it.

thomisus commented 3 years ago

Interested in this as well. We need it in order to comply to GDPR

andryyy commented 3 years ago

For GDPR? Why?

iammattmartin commented 3 years ago

Some countries require a legal imprint on all comms, including who controlling members of staff are.

andryyy commented 3 years ago

It is not that you cannot add a signature as of today. :) You just cannot do it in bulk.

ayushin commented 3 years ago

but i think that's the main show-stopper to use mailcow-dockerized in corporate environments

andryyy commented 3 years ago

I doubt that. We use it in many corporate environments without that feature.

ayushin commented 3 years ago

larger companies (banks, law firms, airlines to name a few) have a policy of adding mandatory disclaimer added to all outgoing post

when i say corporate, i mean corporate, not just business

andryyy commented 3 years ago

We do actually have law firms and banks as customers. :)

If anybody is willing to pay for the development or create a PR, I welcome the change.

ayushin commented 3 years ago

well of course we all speak from own experience and it may be different from country to country and company to company, but for a fact i know of certain corporate policies which require the IT department to ensure/enforce mandatory company-wide disclaimers to avoid employees mistakes or some errors / omissions in setting own signatures, especially when such disclaimers are legally required by country law

thomisus commented 3 years ago

@andryyy What is the correct way to add a signature/disclaimer right now? I mean, not via sogo, but a signature applied by system even if i use an email client. Is there a way even not bulk?

In the past you added every feature that I have requested, so i think it will not be a problem to pay and support this "corporate" feature just to thank you for the great work you are doing :)

thomisus commented 3 years ago

well of course we all speak from own experience and it may be different from country to country and company to company, but for a fact i know of certain corporate policies which require the IT department to ensure/enforce mandatory company-wide disclaimers to avoid employees mistakes or some errors / omissions in setting own signatures, especially when such disclaimers are legally required by country law

I'm in this kind of situation. And the only solution would be to migrate to office 365, which is not an option . mailcow works great with large amounts of email and storage space, it's open and people and community behind it's awesome.

stevenmunro commented 2 years ago

I've also had a request from a client for something like this. In this case, a Christmas message.

Has anybody figure out how to do this themselves?

oliverfarr commented 2 years ago

Hi together,

we also need a solution that allows us to attach one signature per domain. I have also seen that variables are being worked on in the signatures.

Under "What's next" it says "Disclaimers/signatures with variables to use in a pre-defined template per domain and mailbox. 🙂"

Can you give an update on this?

Best regards, Oliver

JlNiko commented 2 years ago

Hello, it will be great to have this option too. Thank you

wornet-aer commented 2 years ago

This feature would be very interesting for us. What is the current state of this?

andryyy commented 2 years ago

I am working and actually almost finished with a pre processor, that will remove Ads and Trackers as well as suspicious CSS and images. Adblocking will be provided by BraveBlock using Adblock lists.

When this part is done, it will be very easy to use it the other way round for changing mail content by part and adding a disclaimer via Jinja template.

It is a pita to walk the parts and modify them. MIME is really a bit...difficult. ;)

fredol commented 2 years ago

Hello Any update on that subject? Best regards

fredol commented 1 year ago

Hello How can I sponsor this feature? All the best

Cryotize commented 1 year ago

Any update on this topic?

sOliverBa commented 1 year ago

I just created an account to join here. It is kinda baffling how often feature requests will be treated like they're not needed or stupid.

Just got out of a meeting with a customer, who wants to change mail server (if necessary), because of that. He simply wants to have a (changeable) company-wide (per domain) signature, which gets automatically added at the end of every outgoing email. Ideally it would be easy to edit, needs HTML coding support (these are styled ones with a banner).

He is willing to help sponsor this feature. At the moment there's another eMail system used right now and i want to use Mailcow as his new one.

andryyy commented 1 year ago

I just left the company and am not working on mailcow anymore.

My trust has been heavily destroyed.

I may or may not work on a modern, more lightweight alternative. Vsevolod implemented some cool mechanisms in Rspamd that would improve handling all kinds of settings and mime part manipulations. Many drawbacks that I always wanted to work on in the past year would be solved. Proper alias expansion would also be possible.

I don't now if there's need for it though. It would be pretty time consuming. Depends on the community feedback.

Perhaps I should start a thread/"poll" on the Hacker News board.

Ad- and tracker removal is something I worked on and pretty much completed a while ago.

Arctize commented 1 year ago

@andryyy I wouldn't mind a bit of context after your statement. What broke your trust? As a user of mailcow, what do I have worry about?

PiotrEsse commented 1 year ago

I just left the company and am not working on mailcow anymore.

My trust has been heavily destroyed.

I may or may not work on a modern, more lightweight alternative. Vsevolod implemented some cool mechanisms in Rspamd that would improve handling all kinds of settings and mime part manipulations. Many drawbacks that I always wanted to work on in the past year would be solved. Proper alias expansion would also be possible.

I don't now if there's need for it though. It would be pretty time consuming. Depends on the community feedback.

Perhaps I should start a thread/"poll" on the Hacker News board.

Ad- and tracker removal is something I worked on and pretty much completed a while ago.

Andryyy, whats going on?? You left Mailcow??

andryyy commented 1 year ago

@PiotrEsse Yes, unfortunately. But new cool projects will grow from it I'm sure. :)

@Arctize I will write about it in the near future. :) Not about details though.

oscarmlage commented 1 year ago

Within the rspamd lua_mime module there is an add_text_footer function that may be a good hint for this topic... hopefully.

After some tries I came across this thread in the rspamd discussions where @vstakhov (the rspamd author) mentions this footer.lua script that does the job.

To test it I entered the rspamd container, added a rspamd.local.lua file with the contents of the footer.lua, and restarted rspamd:

myhost:$ docker-compose exec rspamd-mailcow /bin/bash
rspamd:# nano /etc/rspamd/rspamd.local.lua
 [add the footer.lua content and save]
rspamd:# exit
myhost:$ docker-compose restart rspamd-mailcow
myhost:$ docker-compose logs -f rspamd-mailcow
[...]
mailcowdockerized-rspamd-mailcow-1  | 2023-02-27 20:09:22 #39(controller) <8cc50e>; csession; rspamd_task_write_log: id: <undef>, (default: F (no action): [16.40/9999.00] [HFILTER_HOSTNAME_UNKNOWN(8.50){},BROKEN_HEADERS(8.00){},MIME_GOOD(-0.10){text/plain;},ARC_NA(0.00){},DMARC_NA(0.00){No From header;},MIME_TRACE(0.00){0:+;},MISSING_DATE(0.00){},MISSING_FROM(0.00){},MISSING_MID(0.00){},MISSING_SUBJECT(0.00){},RCPT_COUNT_ONE(0.00){1;},RCVD_COUNT_ZERO(0.00){0;},R_DKIM_NA(0.00){},TEST_FOOTER(0.00){},TO_DN_NONE(0.00){}]), len: 110...

The new prefilter (TEST_FOOTER(0.00){}) was added every time I sent an email, but the footer wasn't working properly in my case. In the HTML version, the footer was added after the </html>, and Mozilla Thunderbird wasn't rendering it correctly:

[...]
</body></html>
<br><p>html footer</p>
--=_81d5e11ca241d02414ad620aec73e4bb--

There was also some other issues with the headers, so I'm not sure if the footer.lua script is only a temporary solution or if there's something else that I missed. I attempted to debug it, but I didn't have the proper environment to do so effectively (my guess is that something weird is happening in the L67 loop ipairs(rewrite.out), but can't say for certain). Also I'm not fluent at all in Lua.

Perhaps @vstakhov (I apologize if this mention bothers you) could provide more documentation or explain how it should work.

Edit: After many attempts, I've got it working with a minor modification, I've added a newline_s to the footer.lua L76:

out_parts[#out_parts + 1] = o .. newline_s

And now the headers and both parts of the email (html and plain) are ok, Thunderbird is able to render the disclaimer and everything seems to work fine. Hope it helps.

pge commented 1 year ago

I just left the company and am not working on mailcow anymore.

My trust has been heavily destroyed.

I may or may not work on a modern, more lightweight alternative. Vsevolod implemented some cool mechanisms in Rspamd that would improve handling all kinds of settings and mime part manipulations. Many drawbacks that I always wanted to work on in the past year would be solved. Proper alias expansion would also be possible.

I don't now if there's need for it though. It would be pretty time consuming. Depends on the community feedback.

Perhaps I should start a thread/"poll" on the Hacker News board.

Ad- and tracker removal is something I worked on and pretty much completed a while ago.

Sorry, to highjack the issue, but i am VERY sorry to hear that. And additional info you are open to provide would be very much appreciated @andryyy Nonetheless, all the best and see you on the "other side" :)

FreddleSpl0it commented 1 year ago

Thanks, @oscarmlage, for all the information. Based on this, I have created a PR https://github.com/mailcow/mailcow-dockerized/pull/5227. I hope this is exactly what was requested. Please feel free to test the PR and provide feedback.

MAGICCC commented 1 year ago

available via https://github.com/mailcow/mailcow-dockerized/pull/5227

thomisus commented 12 months ago

Found a bug #5529