Apply a signature to every mail sent from Nethserver

Hi,
I’m searching for a solution where a signature is applied to all e-mails sent from Nethserver, not only the e-mail sent via Nethtop, bat mail sent via every client that use Nethserver as smtp server (Smartphones, Thunderbird, Outlook, etc…)

These signatures should be in HTML or TXT format, depending of the email format.
They should have placeholders to contain the info from sender (retrieved form Nethserver’s users configuration), insert image embedded (not linked).

Some ideas?

Thank you.

almost impossible to achieve if you don’t have full control over all the devices

in any case, you can create the html signature using a custom template in templates-custom-user tree (if still present)

this template can retrieve all user’s details and create the html file… how to use it it’s up to you

I’m doing something similar on a SME server with SOGo where SOGo is the only email client; all users have the same signature (from a visual perspective) with their personal details… the image is not linked but embedded in the html in base64 format)

HTH

P.S.: even if email signatures are required, they’d never be inserted by the email server, but only by the email client

Could you use the “Append a legal note to sent messages” option?

Go to Email -> Domain, then select a domain and click “Edit”.
Then enable the “Append a legal note to sent messages” option and fill the textarea with a signature.

Am I missing something?

he needs to customize all signatures, IOW, each user must have a different signature with personal details

1 Like

I would like to have a-la-Nethtop signature system but not only for mails written in webtop, but for all the mails that are sent with nethserver, generated by any client (Smartphone mail apps, thunderbird, outlook, etc…) that use Nethserver as gateway (The have the smtp server that point to NEehserver).

you have to decide between:

  • having all the same signature using Giacomo’s advice and using your nethserver as your smtp server (all automagically working with every device/mail app)
  • having customized signatures with no automation and no control

Tertium non datur (Cit.)

altermime and this https://www.howtoforge.com/how-to-automatically-add-a-disclaimer-to-outgoing-emails-with-altermime-postfix-on-debian-squeeze should be a good start…

BRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR!
frightening and IMVHO unusable on a high traffic email server

1 Like

Just a brainfarth: Can you add a mail signature to every user profile (when the account is created) with the variables of the user information coming from samba4 or LDAP? (variables like name, surname, telephone number, office etc…)
Then you have a default signature, but personalized to the sender in the sense of name and other info.

it’s what I suggested in my first answer… the problem is that there’s no way to force any device to use that signature

The next step is to automagically create a signature file of it and inject it in every outgoing mail. Still not a fully personalized signature. It is a tradeoff, but in a company environment I don’t think it is a bad idea to have signatures in a company wide policy.

1 Like

I think if I capture every outgoing mail from Nethserver (I can check the from field and apply the correct template), and smartphones and desktop apps use Nethserver as smtp server, I have that any device uses the signature.

Ok, at the moment I sketched out something that works:

It extracts parameter form “from” header, puts a signature with variables (at the moment it reports only values of “from” header), and it embeds a image (logo) that it’s visible on Thunderbird, Outlook and Aquamail (Android client).

More work to do…

Once done, don’t be shy and release what you found

There’s a new version:

It’s important to remove the old template-custom that are present in previous versions.

https://drive.google.com/uc?export=download&id=13pNUfqY75aiEBf4XTd4KHgAupgUb-Z16

For the installation:

cd /

tar xvjf /path/where/install/package/is/copied.tar.bz2

mkdir -p /var/spool/addsignatures
chmod 750 /var/spool/addsignatures
chown mail:mail /var/spool/addsignatures

signal-event nethserver-mail-server-update

Docs in /var/lib/nethserver/mail-disclaimers/docs

Please note that this script works modifying /etc/postfix/master.cf where amavisd re-inject messages into postfix (30postfix-queue section). When amavisd will be gone (beacuse adoption of rspamd), we will find another point where to apply the filter “-o content_filter=disclaimer:”.

3 Likes

There’s an open PR for that

My script is based/modified on the same script that @stephdl uses in “Disclaimer by altemime” above and already doesn’t use amavisd to work.

At the moment I put the filter on the “30postifx-queue” section of /etc/postfix/master.cf because I find that’s the only place where the filter is called.

I think that when amavisd is removed, the section will also be removed or modified. So I don’t know if it will be the right position for the filter.

If the new mail implementation (rspamd) reaches feature parity with the old one (amavisd) it’s possible to ship it as a replacement in a normal update run.

Until we reach that point, the two alternatives will be both available.

1 Like

The script working perfect, only one question. Is it possible to set signature by Sender Real name or some other data what can have only one user. We have here e-mails what are used from more users, but the signatures must be (different) from the user.

O_o

First thing: I’m amazed that someone uses that script :slight_smile:

The only thing that comes in my mind is to use the descriptive part of the From: header

For example, if the From header is

From: Saito Benkei <saitobenkei@domain.tld>

I can make the user comparison on the “Saito Benkei” part and not on “saitobenkei” mail address part.

It is however necessary that each client of that user produces an equal header description (same spaces, lower/uppercases, etc…)

For example:, if the user has Thunderbird on the PC and another mail client on his/her smartphone, both must fill in the From field with the same description.

So, i can’t have Thunderbird that produces “Saito Benkei <saitobenkei@domain.tld>” and smartphone’s email client that produces “Saito Benkei Mobile <saitobenkei@domain.tld>”.

Both clients have to compile the From header with “Saito Benkei <saitobenkei@domain.tld>

So you have to configure in Thunderbird the “Your Name” field in the account as “Saito Benkei”. Same thing in the smartphone’s email-client.

Here there’s a untested version of the script (v0.10):

https://drive.google.com/uc?export=download&id=13vRm3K-9RX0QuUNXfopxo8UANbHT_1uY

extract the script (it’s contain addsignatures script only) and copy on

/var/lib/nethserver/mail-disclaimers/scripts

then

chown root:adm /var/lib/nethserver/mail-disclaimers/scripts/addsignatures
chmod 755 /var/lib/nethserver/mail-disclaimers/scripts/addsignatures

edit the file addsignatures and change the READFROMDESC variable’s value to 1

then modify your /var/lib/nethserver/mail-disclaimers/domain.tld/users/users.txt changing the first field of every line with the exact description that you put in your email client

For example:

If your line was
saitobenkei|mr.|Saito|Benkei|saitobenkei@domain.tld|...

You have to change in
Saito Benkei|mr.|Saito|Benkei|saitobenkei@domain.tld|...
Minnie Pluto|mrs.|Minnie|Pluto|saitobenkei@domain.tld|...

So you can have multiple lines with the same email address but different users.

Please, tell me if it works!

As usuaI have no responsibility for the loss of data, blah, blah blah…

3 Likes