1

Topic: Adding disclaimer in html and plain text for individual domains

==== Required information ====
- iRedMail version: 0.8.4
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: Cent OS 6.4
- Related log if you're reporting an issue:
====
Hi,

How to add disclaimer in html and plain text for individual domains and global domains.

I have tried with plain text in default.txt it is wokring fine but with default.html nothing attached to mail.

Please find the attached html file.

Amavis configuration.
-----------------------------

$altermime = '/usr/bin/altermime';

# Disclaimer in plain text formart.
#@altermime_args_disclaimer = qw(--disclaimer=/etc/postfix/disclaimer/_OPTION_.txt --disclaimer-html=/etc/postfix/disclaimer/_OPTION_.txt --force-for-bad-html);
@altermime_args_disclaimer = qw(--disclaimer=/etc/postfix/disclaimer/_OPTION_.txt --disclaimer-html=/etc/postfix/disclaimer/_OPTION_.html);

@disclaimer_options_bysender_maps = ({
    # Per-domain disclaimer setting: /etc/postfix/disclaimer/host1.iredmail.org.txt
    #'host1.iredmail.org' => 'host1.iredmail.org',

    # Sub-domain disclaimer setting: /etc/postfix/disclaimer/iredmail.org.txt
    #'.iredmail.org'      => 'iredmail.org',

    # Per-user disclaimer setting: /etc/postfix/disclaimer/boss.iredmail.org.txt
    #'boss@iredmail.org'  => 'boss.iredmail.org',

    # Catch-all disclaimer setting: /etc/postfix/disclaimer/default.txt
    '.' => 'default',
},);

---------------------------------------------------------------------------------------------------------

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Adding disclaimer in html and plain text for individual domains

@altermime_args_disclaimer = qw(--disclaimer=/etc/postfix/disclaimer/_OPTION_.txt --disclaimer-html=/etc/postfix/disclaimer/_OPTION_.html);

Your setting is correct. Do you have file /etc/postfix/disclaimer/default.html?

3

Re: Adding disclaimer in html and plain text for individual domains

ZhangHuangbin wrote:

@altermime_args_disclaimer = qw(--disclaimer=/etc/postfix/disclaimer/_OPTION_.txt --disclaimer-html=/etc/postfix/disclaimer/_OPTION_.html);

Your setting is correct. Do you have file /etc/postfix/disclaimer/default.html?


Yes i have  /etc/postfix/disclaimer/default.html

please find the ls -l /etc/postfix/disclaimer/ and cat of default.html

[root@mail dkim]# ll /etc/postfix/disclaimer/
total 4
-rw-r--r-- 1 root root 825 Jun 24 18:04 default.html
[root@mail dkim]# cat /etc/postfix/disclaimer/default.html
<BR CLEAR="ALL">
<HR width="100%" />
<font color="#009900" face="Webdings" size="4">P</font><font  color="#009900" face="verdana,arial,helvetica" size="2"> <strong>Please consider the environment before printing this email</strong></font>
<td style="padding-left: 0px;">
<span style="color: #8A8A8A; font-family: 'Calibri', sans-serif; font-size: 10pt; font-weight: regular;">
<br>
<b>Confidentiality Note:</b> This e-mail and any attachments are confidential and may be protected by legal privilege. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please notify us immediately by returning it to the sender and delete this copy from your system. Thank you for your cooperation.
<br>
[root@mail dkim]#

4

Re: Adding disclaimer in html and plain text for individual domains

Could you please turn on debug mode in Amavisd config file ($log_level=5;)and test again? Check its log file (/var/log/maillog) and try to figure out why. if you're not sure what happened, please paste related log of full smtp session here so that others can help.

5

Re: Adding disclaimer in html and plain text for individual domains

ZhangHuangbin wrote:

Could you please turn on debug mode in Amavisd config file ($log_level=5;)and test again? Check its log file (/var/log/maillog) and try to figure out why. if you're not sure what happened, please paste related log of full smtp session here so that others can help.

Hi,


When amavis config is set to this @altermime_args_disclaimer = qw(--disclaimer=/etc/postfix/disclaimer/_OPTION_.txt --disclaimer-html=/etc/postfix/disclaimer/_OPTION_.html);

OUTPUT
------------
Jun 25 18:24:08 mail amavis[8755]: (08755-02) (!!)collect_results from [9508] (/usr/bin/altermime): DIED, signal 11 (000b) mime_alter.c:1401:AM_disclaimer_load_text:ERROR: Cannot stat '/etc/postfix/disclaimer/default.txt' (No such file or directory)\n
Jun 25 18:24:08 mail amavis[8755]: (08755-02) program /usr/bin/altermime said: mime_alter.c:1401:AM_disclaimer_load_text:ERROR: Cannot stat '/etc/postfix/disclaimer/default.txt' (No such file or directory)\n
Jun 25 18:24:08 mail amavis[8755]: (08755-02) (!)mangling by altermime failed: Program /usr/bin/altermime failed: 11, mime_alter.c:1401:AM_disclaimer_load_text:ERROR: Cannot stat '/etc/postfix/disclaimer/default.txt' (No such file or directory), mail will pass unmodified
Jun 25 18:24:08 mail amavis[8755]: (08755-02) dkim: candidate originators: 2822.From:<postmaster@unicel.in>, 2821.mail_from:<postmaster@unicel.in>


when amavis config is set to this  @altermime_args_disclaimer = qw(--disclaimer-html=/etc/postfix/disclaimer/_OPTION_.html);

OUTPUT
-------------
Jun 25 18:31:45 mail amavis[12820]: (12820-01) run_command: [12918] /usr/bin/altermime --input=/var/amavis/tmp/amavis-20130625T183145-12820/email-repl.txt --disclaimer-html=/etc/postfix/disclaimer/default.html </dev/null 2>&1
Jun 25 18:31:45 mail amavis[12918]: (12820-01) open_on_specific_fd: target fd0 closing, to become < /dev/null
Jun 25 18:31:45 mail amavis[12918]: (12820-01) open_on_specific_fd: target fd1 closing, to become > &=16
Jun 25 18:31:45 mail amavis[12918]: (12820-01) open_on_specific_fd: target fd1 dup2 from fd16 > &=16
Jun 25 18:31:45 mail amavis[12918]: (12820-01) open_on_specific_fd: source fd16 closed
Jun 25 18:31:45 mail amavis[12918]: (12820-01) open_on_specific_fd: target fd2 closing, to become > &1
Jun 25 18:31:45 mail amavis[12918]: (12820-01) open_on_specific_fd: target fd2 dup2 from fd1 > &1
Jun 25 18:31:45 mail amavis[12820]: (12820-01) collect_results from [12918] (/usr/bin/altermime), 2641 bytes, (limit 16384)
Jun 25 18:31:45 mail amavis[12820]: (12820-01) (!!)collect_results from [12918] (/usr/bin/altermime): exit 1 Error: Must specify an action for the input file.\naltermime --input=<input mime pack>   ( --input=- for stdin )\n\t[--disclaimer=<disclaimer file>]\n\t[--disclaimer-html=<HTML disclaimer file>]\n\t[--disclaimer-b64=<BASE64 encoded dislcaimer>]\n\t[--htmltoo]\n  [--force-into-b64]\n\t[--force-for-bad-html]\n\t[--multipart-insert]\n\t[--remove=<remove file name (regex)>] (if filename contains a /, matches on mime-type )\n\t[--removeall]\n\t[--replace=<filename to replace> --with=<replace with>]\n\t[--xheader="..."\n\t[--alter-header="..." --alter-with="..." --alter-mode=<prefix|suffix|replace>]\n\t[--altersigned]\n\t[--no-qmail-bounce]\n\t[--verbose]\n\t[--log-stdout]\n\t[--log-stderr]\n\t[--log-syslog]\n\t[--debug]\n\t[--version]\n\nOption Descriptions:\n\t--input=, Sets the mailpack file to be the filename supplied,\n\t\tif the filename is a single '-' (hyphen) then the mailpack\n\t\tis sou...
Jun 25 18:31:45 mail amavis[12820]: (12820-01) (!!)...rced via stdin and outputted via stdout.\n\n\t--disclaimer=, Set the plaintext disclaimer source file.\n\t--disclaimer-html=, Set the HTML disclaimer source file.\n\t--disclaimer-b64=, Set the BASE64 encoded disclaimer source file (implies --force-into-b64).\n\n\t--htmltoo, Sets alterMIME to insert the plaintext disclaimer into\n\t--force-into-b64, Sets alterMIME to insert disclaimers into BASE64 encoded text segments\n\t--force-for-bad-html, Force adding of the HTML disclaimer even when HTML is not correctly formatted\n\t\tthe HTML portion of the email body ( if there is no explicitly\n\t\tdefined HTML dislcaimer, see --disclaimer-html )\n\n\t--remove=, Remove any attachments which match the filename supplied,\n\t\tif the filename text contains a forward-slash '/', then the\n\t\tmatching will occur based on content-type headers rather than\n\t\tby filename.\n\t--removeall, Remove all attachments\n\t--replace=, Replace attachments matching the g...
Jun 25 18:31:45 mail amavis[12820]: (12820-01) (!!)...iven filename. Requires to\n\t\tbe used with --with.\n\t--with=, Replace the attachments specified by --replace with the file\n\t\tspecified.\n\t--xheader=, Insert a header line as specified into the first set of headers.\n\t--alter-header="..." --alter-with="..." --alter-mode=(prefix|suffix|replace)\n\t\tAlter an existing header in the mailpack.  This function modifies the\n\t\tvalue of the header, as apposed to the header name.\n\t--altersigned, Force alterMIME to modify 'signed' emails\n\t--no-qmail-bounce,  Don't search into email bodies for attachment headers\n\t--verbose, Describe details of the process occuring\n\t--log-stdout, Send all output messages to stdout\n\t--log-stderr, Send all output messages to stderr\n\t--log-syslog, Send all output messages to syslog\n\t--debug, Provide greater verbosity and debugging information\n\t--version, display the alterMIME version string\n\n
Jun 25 18:31:45 mail amavis[12820]: (12820-01) program /usr/bin/altermime said: Error: Must specify an action for the input file.\naltermime --input=<input mime pack>   ( --input=- for stdin )\n\t[--disclaimer=<disclaimer file>]\n\t[--disclaimer-html=<HTML disclaimer file>]\n\t[--disclaimer-b64=<BASE64 encoded dislcaimer>]\n\t[--htmltoo]\n  [--force-into-b64]\n\t[--force-for-bad-html]\n\t[--multipart-insert]\n\t[--remove=<remove file name (regex)>] (if filename contains a /, matches on mime-type )\n\t[--removeall]\n\t[--replace=<filename to replace> --with=<replace with>]\n\t[--xheader="..."\n\t[--alter-header="..." --alter-with="..." --alter-mode=<prefix|suffix|replace>]\n\t[--altersigned]\n\t[--no-qmail-bounce]\n\t[--verbose]\n\t[--log-stdout]\n\t[--log-stderr]\n\t[--log-syslog]\n\t[--debug]\n\t[--version]\n\nOption Descriptions:\n\t--input=, Sets the mailpack file to be the filename supplied,\n\t\tif the filename is a single '-' (hyphen) then the mailpack\n\t\tis sourced via stdin and outputted ...
Jun 25 18:31:45 mail amavis[12820]: (12820-01) ...via stdout.\n\n\t--disclaimer=, Set the plaintext disclaimer source file.\n\t--disclaimer-html=, Set the HTML disclaimer source file.\n\t--disclaimer-b64=, Set the BASE64 encoded disclaimer source file (implies --force-into-b64).\n\n\t--htmltoo, Sets alterMIME to insert the plaintext disclaimer into\n\t--force-into-b64, Sets alterMIME to insert disclaimers into BASE64 encoded text segments\n\t--force-for-bad-html, Force adding of the HTML disclaimer even when HTML is not correctly formatted\n\t\tthe HTML portion of the email body ( if there is no explicitly\n\t\tdefined HTML dislcaimer, see --disclaimer-html )\n\n\t--remove=, Remove any attachments which match the filename supplied,\n\t\tif the filename text contains a forward-slash '/', then the\n\t\tmatching will occur based on content-type headers rather than\n\t\tby filename.\n\t--removeall, Remove all attachments\n\t--replace=, Replace attachments matching the given filename. Requires to\n\t\tb...
Jun 25 18:31:45 mail amavis[12820]: (12820-01) ...e used with --with.\n\t--with=, Replace the attachments specified by --replace with the file\n\t\tspecified.\n\t--xheader=, Insert a header line as specified into the first set of headers.\n\t--alter-header="..." --alter-with="..." --alter-mode=(prefix|suffix|replace)\n\t\tAlter an existing header in the mailpack.  This function modifies the\n\t\tvalue of the header, as apposed to the header name.\n\t--altersigned, Force alterMIME to modify 'signed' emails\n\t--no-qmail-bounce,  Don't search into email bodies for attachment headers\n\t--verbose, Describe details of the process occuring\n\t--log-stdout, Send all output messages to stdout\n\t--log-stderr, Send all output messages to stderr\n\t--log-syslog, Send all output messages to syslog\n\t--debug, Provide greater verbosity and debugging information\n\t--version, display the alterMIME version string\n\n
Jun 25 18:31:45 mail amavis[12820]: (12820-01) (!)mangling by altermime failed: Program /usr/bin/altermime failed: 256, Error: Must specify an action for the input file.\naltermime --input=<input mime pack>   ( --input=- for stdin )\n\t[--disclaimer=<disclaimer file>]\n\t[--disclaimer-html=<HTML disclaimer file>]\n\t[--disclaimer-b64=<BASE64 encoded dislcaimer>]\n\t[--htmltoo]\n  [--force-into-b64]\n\t[--force-for-bad-html]\n\t[--multipart-insert]\n\t[--remove=<remove file name (regex)>] (if filename contains a /, matches on mime-type )\n\t[--removeall]\n\t[--replace=<filename to replace> --with=<replace with>]\n\t[--xheader="..."\n\t[--alter-header="..." --alter-with="..." --alter-mode=<prefix|suffix|replace>]\n\t[--altersigned]\n\t[--no-qmail-bounce]\n\t[--verbose]\n\t[--log-stdout]\n\t[--log-stderr]\n\t[--log-syslog]\n\t[--debug]\n\t[--version]\n\nOption Descriptions:\n\t--input=, Sets the mailpack file to be the filename supplied,\n\t\tif the filename is a single '-' (hyphen) then the mailpack\...
Jun 25 18:31:45 mail amavis[12820]: (12820-01) (!)...n\t\tis sourced via stdin and outputted via stdout.\n\n\t--disclaimer=, Set the plaintext disclaimer source file.\n\t--disclaimer-html=, Set the HTML disclaimer source file.\n\t--disclaimer-b64=, Set the BASE64 encoded disclaimer source file (implies --force-into-b64).\n\n\t--htmltoo, Sets alterMIME to insert the plaintext disclaimer into\n\t--force-into-b64, Sets alterMIME to insert disclaimers into BASE64 encoded text segments\n\t--force-for-bad-html, Force adding of the HTML disclaimer even when HTML is not correctly formatted\n\t\tthe HTML portion of the email body ( if there is no explicitly\n\t\tdefined HTML dislcaimer, see --disclaimer-html )\n\n\t--remove=, Remove any attachments which match the filename supplied,\n\t\tif the filename text contains a forward-slash '/', then the\n\t\tmatching will occur based on content-type headers rather than\n\t\tby filename.\n\t--removeall, Remove all attachments\n\t--replace=, Replace attachments matc...
Jun 25 18:31:45 mail amavis[12820]: (12820-01) (!)...hing the given filename. Requires to\n\t\tbe used with --with.\n\t--with=, Replace the attachments specified by --replace with the file\n\t\tspecified.\n\t--xheader=, Insert a header line as specified into the first set of headers.\n\t--alter-header="..." --alter-with="..." --alter-mode=(prefix|suffix|replace)\n\t\tAlter an existing header in the mailpack.  This function modifies the\n\t\tvalue of the header, as apposed to the header name.\n\t--altersigned, Force alterMIME to modify 'signed' emails\n\t--no-qmail-bounce,  Don't search into email bodies for attachment headers\n\t--verbose, Describe details of the process occuring\n\t--log-stdout, Send all output messages to stdout\n\t--log-stderr, Send all output messages to stderr\n\t--log-syslog, Send all output messages to syslog\n\t--debug, Provide greater verbosity and debugging information\n\t--version, display the alterMIME version string\n, mail will pass unmodified

6

Re: Adding disclaimer in html and plain text for individual domains

kiran wrote:

Jun 25 18:24:08 mail amavis[8755]: (08755-02) (!!)collect_results from [9508] (/usr/bin/altermime): DIED, signal 11 (000b) mime_alter.c:1401:AM_disclaimer_load_text:ERROR: Cannot stat '/etc/postfix/disclaimer/default.txt' (No such file or directory)\n

It cannot find file /etc/postfix/disclaimer/default.txt, are you sure this file exists?

kiran wrote:

when amavis config is set to this  @altermime_args_disclaimer = qw(--disclaimer-html=/etc/postfix/disclaimer/_OPTION_.html);

Did you try append option '--force-for-bad-html'?

7

Re: Adding disclaimer in html and plain text for individual domains

ZhangHuangbin wrote:
kiran wrote:

Jun 25 18:24:08 mail amavis[8755]: (08755-02) (!!)collect_results from [9508] (/usr/bin/altermime): DIED, signal 11 (000b) mime_alter.c:1401:AM_disclaimer_load_text:ERROR: Cannot stat '/etc/postfix/disclaimer/default.txt' (No such file or directory)\n

It cannot find file /etc/postfix/disclaimer/default.txt, are you sure this file exists?

kiran wrote:

when amavis config is set to this  @altermime_args_disclaimer = qw(--disclaimer-html=/etc/postfix/disclaimer/_OPTION_.html);

Did you try append option '--force-for-bad-html'?

Yes i tried with --force-for-bad-html even though it's not working.

If both default.txt and default.html is located in disclaimer folder amavisd is is taking default.txt but it's not taking default.html.

if only default.html located @ disclaimer folder it's not appending in mail.

8

Re: Adding disclaimer in html and plain text for individual domains

kiran wrote:

Yes i tried with --force-for-bad-html even though it's not working.

No idea yet, sorry.

kiran wrote:

If both default.txt and default.html is located in disclaimer folder amavisd is is taking default.txt but it's not taking default.html.
if only default.html located @ disclaimer folder it's not appending in mail.

Does it work if you place '--disclaimer--html' before '--disclaimer'? i guess not, but you can try it.

9

Re: Adding disclaimer in html and plain text for individual domains

ZhangHuangbin wrote:
kiran wrote:

Yes i tried with --force-for-bad-html even though it's not working.

No idea yet, sorry.

kiran wrote:

If both default.txt and default.html is located in disclaimer folder amavisd is is taking default.txt but it's not taking default.html.
if only default.html located @ disclaimer folder it's not appending in mail.

Does it work if you place '--disclaimer--html' before '--disclaimer'? i guess not, but you can try it.

Let me try with different options then if i found any thing i will post.

Thanks for your time.

10

Re: Adding disclaimer in html and plain text for individual domains

hi kiran,

have you solve your error to add html disclaimer ?

i have the same problem : text disclaimer is good but not html.

thank