Email redirection: Difference between revisions

No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''This document gather possibilities of email redirection using postfix and zimbra. Please note these modifications may not survive zimbra upgrades.'''
{{BC|Community Sandbox}}
__FORCETOC__
<div class="col-md-12 ibox-content">
=Email redirection=
{{KB|{{Unsupported}}|{{ZCS 8.6}}|{{ZCS 8.5}}|{{ZCS 8.0}}|}}
{{WIP}}
==Purpose==
User or admin, likes to forward all incoming emails thats going to one account to multiple recipient.


==Resolution==
===Redirection based on sender address===
In this example, emails send from '''user@domain.com''' will be trapped and sent to '''user_trapped@domain2.com'''. We are using check_sender_access to achieve this.
* Enter following in the file '''/opt/zimbra/conf/postfix_recipient_restrictions.cf''' Make sure it is entered at the top of the file.
  vi /opt/zimbra/conf/postfix_recipient_restrictions.cf


__TOC__
'''Zimbra 8.5 or above:'''
check_sender_access lmdb:/opt/zimbra/postfix/conf/restricted_senders


==Redirection based on sender address==
'''Zimbra 8.0.9 or earlier:'''
 
   check_sender_access hash:/opt/zimbra/postfix/conf/restricted_senders
In this example, emails send from user@domain.com will be trapped and sent to user_trapped@domain2.com. We are using check_sender_access to achieve this.
* Create a file '''/opt/zimbra/postfix/conf/restricted_senders''' and list all the users, whose emails you want to redirect.
 
   cat /opt/zimbra/postfix/conf/restricted_senders
1. Enter following in the file “/opt/zimbra/conf/postfix_recipient_restrictions.cf”. Make sure it is entered at the top of the file.
 
  ''vi /opt/zimbra/conf/postfix_recipient_restrictions.cf
   check_sender_access hash:/opt/zimbra/postfix/conf/restricted_senders''
 
2. Create a file "/opt/zimbra/postfix/conf/restricted_senders" and list all the users, whose emails you want to redirect.
 
   ''cat /opt/zimbra/postfix/conf/restricted_senders
   user@domain.com REDIRECT user_trapped@domain2.com
   user@domain.com REDIRECT user_trapped@domain2.com
   user2@domain.com REDIRECT user2_trapped@zbc.com
   user2@domain.com REDIRECT user2_trapped@zbc.com
   ...''
   ...
 
* Create the hash and restart postfix.
3. Create the hash and restart postfix.
   postmap /opt/zimbra/postfix/conf/restricted_senders
   ''postmap /opt/zimbra/postfix/conf/restricted_senders
   zmmtactl restart
   zmmtactl stop
  zmmtactl start''
 
'''Test'''
 
Login as user@domain.com and try sending email to any address. It will be redirected to user_trapped@domain2.com account and the log entry should look like this in /var/log/zimbra.log


====Test====
Login as user@domain.com and try sending email to any address. It will be redirected to user_trapped@domain2.com account and the log entry should look like this in '''/var/log/zimbra.log'''
   Apr 12 10:08:34 mta postfix/smtpd[521]: NOQUEUE: redirect: RCPT from domain.com[xx.xx.xx.xx]: <user@domain.com>: Sender address triggers REDIRECT  
   Apr 12 10:08:34 mta postfix/smtpd[521]: NOQUEUE: redirect: RCPT from domain.com[xx.xx.xx.xx]: <user@domain.com>: Sender address triggers REDIRECT  
   user_trapped@domain2.com; from=<user@domain.com> to=<realrecipient@domain.com> proto=ESMTP
   user_trapped@domain2.com; from=<user@domain.com> to=<realrecipient@domain.com> proto=ESMTP


==Sender BCC Maps==
===Sender BCC Maps===
 
In this example, we need a copy of all emails sent FROM '''user@domain.com''' to '''bccuser@domain.com''' user. I am using sender_bcc_maps.
In this example, we need a copy of all emails sent FROM user@domain.com to bccuser@domain.com user. I am using sender_bcc_maps.
 
1. Enter following line at the end of file /opt/zimbra/postfix/main.cf file.
 
  ''sender_bcc_maps = hash:/opt/zimbra/postfix/conf/sender_bcc''


2. Create a file /opt/zimbra/postfix/sender_bcc and add the sender address and forward address in following format. You can enter a list of users.
* Enter following line at the end of file /opt/zimbra/postfix/main.cf file.
'''Zimbra 8.5 or above:'''
sender_bcc_maps = lmdb:/opt/zimbra/postfix/conf/sender_bcc
recipient_bcc_maps = lmdb:/opt/zimbra/postfix/conf/recipient_bcc


  ''cat /opt/zimbra/postfix/sender_bcc
'''Zimbra 8.0.9 or earlier:'''
  user@domain.com bccuser@domain.com''
sender_bcc_maps = hash:/opt/zimbra/postfix/conf/sender_bcc
  recipient_bcc_maps = hash:/opt/zimbra/postfix/conf/recipient_bcc


3. Create the hash and reload postfix.
* Create a file /opt/zimbra/postfix/sender_bcc and add the sender address and forward address in following format. You can enter a list of users.
cat /opt/zimbra/postfix/sender_bcc
user@domain.com  bccuser@domain.com
* Create the hash and reload the MTA.
  postmap /opt/zimbra/postfix/conf/sender_bcc
  postmap /opt/zimbra/postfix/conf/recipient_bcc
  zmmtactl restart


  ''postmap /opt/zimbra/postfix/sender_bcc
====Test====
  postfix reload''
Send an email from '''user@domain.com''' and check the logs in '''zimbra.log'''. You should see two send entries, one for '''user@domain.com''' and other for '''bccuser@domain.com'''


'''Test'''
==Additional Content==
* Not related content.


Send an email from user@domain.com and check the logs in zimbra.log. You should see two send entries, one for user@domain.com and other for bccuser@domain.com
{{Article Footer|Zimbra Collaboration 8.6, 8.5, 8.0|04/12/2012}}
{{NeedSME|SME1|SME2|Copyeditor}}

Latest revision as of 17:52, 11 July 2015

Email redirection

   KB 16152        Last updated on 2015-07-11  




0.00
(0 votes)

Purpose

User or admin, likes to forward all incoming emails thats going to one account to multiple recipient.

Resolution

Redirection based on sender address

In this example, emails send from user@domain.com will be trapped and sent to user_trapped@domain2.com. We are using check_sender_access to achieve this.

  • Enter following in the file /opt/zimbra/conf/postfix_recipient_restrictions.cf Make sure it is entered at the top of the file.
 vi /opt/zimbra/conf/postfix_recipient_restrictions.cf

Zimbra 8.5 or above:

check_sender_access lmdb:/opt/zimbra/postfix/conf/restricted_senders

Zimbra 8.0.9 or earlier:

 check_sender_access hash:/opt/zimbra/postfix/conf/restricted_senders
  • Create a file /opt/zimbra/postfix/conf/restricted_senders and list all the users, whose emails you want to redirect.
 cat /opt/zimbra/postfix/conf/restricted_senders
 user@domain.com REDIRECT user_trapped@domain2.com
 user2@domain.com REDIRECT user2_trapped@zbc.com
 ...
  • Create the hash and restart postfix.
 postmap /opt/zimbra/postfix/conf/restricted_senders
 zmmtactl restart 

Test

Login as user@domain.com and try sending email to any address. It will be redirected to user_trapped@domain2.com account and the log entry should look like this in /var/log/zimbra.log

 Apr 12 10:08:34 mta postfix/smtpd[521]: NOQUEUE: redirect: RCPT from domain.com[xx.xx.xx.xx]: <user@domain.com>: Sender address triggers REDIRECT 
 user_trapped@domain2.com; from=<user@domain.com> to=<realrecipient@domain.com> proto=ESMTP

Sender BCC Maps

In this example, we need a copy of all emails sent FROM user@domain.com to bccuser@domain.com user. I am using sender_bcc_maps.

  • Enter following line at the end of file /opt/zimbra/postfix/main.cf file.

Zimbra 8.5 or above:

sender_bcc_maps = lmdb:/opt/zimbra/postfix/conf/sender_bcc
recipient_bcc_maps = lmdb:/opt/zimbra/postfix/conf/recipient_bcc

Zimbra 8.0.9 or earlier:

sender_bcc_maps = hash:/opt/zimbra/postfix/conf/sender_bcc
recipient_bcc_maps = hash:/opt/zimbra/postfix/conf/recipient_bcc
  • Create a file /opt/zimbra/postfix/sender_bcc and add the sender address and forward address in following format. You can enter a list of users.
cat /opt/zimbra/postfix/sender_bcc
user@domain.com  bccuser@domain.com
  • Create the hash and reload the MTA.
 postmap /opt/zimbra/postfix/conf/sender_bcc
 postmap /opt/zimbra/postfix/conf/recipient_bcc
 zmmtactl restart

Test

Send an email from user@domain.com and check the logs in zimbra.log. You should see two send entries, one for user@domain.com and other for bccuser@domain.com

Additional Content

  • Not related content.
Verified Against: Zimbra Collaboration 8.6, 8.5, 8.0 Date Created: 04/12/2012
Article ID: https://wiki.zimbra.com/index.php?title=Email_redirection Date Modified: 2015-07-11



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »


Wiki/KB reviewed by SME1 SME2 Copyeditor Last edit by Jorge de la Cruz
Jump to: navigation, search