Warning message in mail

Mark Sapiro mark at msapiro.net
Sat Jan 12 19:22:41 UTC 2019

On 1/12/19 6:41 AM, Datasoft-India wrote:
> Hello all,
> I want to add a line at the top of each incoming mail from external
> domains as follows
> "This email originated outside the organization. Do not click any links
> or attachments unless you know the sender"
> How is that possible.

Assuming you mean you want to add the line in the body of the email,
MailScanner doesn't do that and it is very difficult to do. Consider
that an email message body can be simple text/plain, simple text/html,
or various kinds of multipart including multipart/alternative with both
text/plain and text/html and possibly other alternative parts.

In these latter cases, it is impossible to know which text/* part is
going to be displayed to the user because it depends on the users MUA
and preferences. Thus you have to add the warning to every text/* part
in the message.

Adding the warning to a text/plain part is straightforward and in the
simple text/plain email case would work, but in the
multipart/alternative case, that's insufficient because it is more often
the text/html part the user sees.

Adding text to text/html parts is not at all straightforward. In order
to know what to add and where, you have to know how the particular
user's MUA will render the HTML which will vary depending on the MUA.

The best you can do I think is to add your warning text to the Subject:

You might be able to do that with MailScanner using something like
Scanned Modify Subject and Scanned Subject Text in conjunction with a
ruleset to to only apply the modification to external mail.

Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

More information about the MailScanner mailing list