From 57d57fc3300fcdfbbd123d7a2b546dc85db189e4 Mon Sep 17 00:00:00 2001 From: Zhang Huangbin Date: Wed, 17 Sep 2014 12:53:49 +0800 Subject: [PATCH] Review pipe.incoming.email.for.certain.user.to.external.script.md. --- ...ail.for.certain.user.to.external.script.md | 69 ++++++++++++++++ ...to.configure.thunderbird.for.iredmail.html | 2 +- ...l.for.certain.user.to.external.script.html | 80 +++++++++++++++++++ html/index.html | 3 +- html/index.md | 3 +- ...ail.for.certain.user.to.external.script.md | 46 ----------- 6 files changed, 154 insertions(+), 49 deletions(-) create mode 100644 3-faq-howto/pipe.incoming.email.for.certain.user.to.external.script.md create mode 100644 html/faq-howto/pipe.incoming.email.for.certain.user.to.external.script.html delete mode 100644 pipe.incoming.email.for.certain.user.to.external.script.md diff --git a/3-faq-howto/pipe.incoming.email.for.certain.user.to.external.script.md b/3-faq-howto/pipe.incoming.email.for.certain.user.to.external.script.md new file mode 100644 index 00000000..8cd3131f --- /dev/null +++ b/3-faq-howto/pipe.incoming.email.for.certain.user.to.external.script.md @@ -0,0 +1,69 @@ +# How to pipe incoming email for certain user to external script + +This tutorial explains how to pipe incoming email for certain user to external script. + +## Configure Postfix to use your external script as transport + +To pipe incoming emails to external script, you must add your external script +as Postfix transport program. Please add below line at the bottom of Postfix +config file `/etc/postfix/master.cf`: + +``` +external-pipe unix - n n - - pipe + flags= user=vmail:vmail argv=/path/to/your/external/script.sh +``` + +__Note__: + +* You can use some macros to replace with corresponding information from the +Postfix queue manager delivery request. Refer to Postfix manual page for more +detail: ()[http://www.postfix.org/pipe.8.html]. For example: + +``` +external-pipe unix - n n - - pipe + flags=DRhu user=vmail:vmail argv=/path/to/your/external/script.sh -f ${sender} -d ${user}@${domain} -m ${extension} +``` + +* the second line needs to be right under the first line and must start with +one (or more) whitespace, and the first line cannot start with whitespace, +otherwise postfix will fail with `unexpected command-line argument` errors. +Also make sure the `user=` line is pointing to a valid user with permissions +to execute the script. This user must not be the postfix or root user, otherwise +or the pipe will fail. + +Now restart Postfix service to make this new transport available: + +``` +# /etc/init.d/postfix restart +``` + +## Update per-user transport to use this new transport + +We need to update per-user transport setting, so that all emails delivered to +this user will be piped to this new transport - your script. + +* If you have iRedAdmin-Pro: + + * For iRedAdmin-Pro-LDAP installed, please go to user profile page, under +tab `Advanced`, set `Relay/Transport setting` to `external-pipe`. Screenshot for +your reference: ()[http://www.iredmail.org/images/iredadmin/user_profile_relay.png] + + * For iRedAdmin-Pro-MySQL or iRedAdmin-Pro-PGSQL installed, please go +to user profile page, under tab `Relay`, set `/Transport setting` to +`external-pipe`. + +* If you don't have iRedAdmin-Pro, please update LDAP/MySQL/PgSQL database to +use this new transport. + + * For OpenLDAP backend, please login to phpLDAPadmin, add new attribute + `mtaTransport` for your user, set its value to `external-pipe`. + + * For MySQL/PostgreSQL backend, please execute below command with SQL + command line tool (Replace 'user@domain.ltd' by the real email address): + +```mysql +sql> USE vmail; +sql> UPDATE mailbox SET transport='external-pipe' WHERE username='user@domain.ltd'; +``` + +That's all. diff --git a/html/faq-howto/howto.configure.thunderbird.for.iredmail.html b/html/faq-howto/howto.configure.thunderbird.for.iredmail.html index 1d12ae34..1dff8351 100644 --- a/html/faq-howto/howto.configure.thunderbird.for.iredmail.html +++ b/html/faq-howto/howto.configure.thunderbird.for.iredmail.html @@ -12,7 +12,7 @@

Create new mail account

To create a new mail account with Thunderbird, please click menu: File -> New -> Mail Account.

Add your name, email address and password in this screen.

-

[[File:../images/thunderbird.new.mail.account.png]]

+

Click continue, it will detect IMAP and SMTP server automatically.

Note:

Backup and Restore