User Tools

Site Tools


dev_cache_all

Catch ALL for testing

During development you need scenario when all email should goes to only one email.
which is most important requirement for developer as they want to test email as well they need confirmation.

Here is what i have applied on postfix.

I am sending all email to [email protected]

main.cf

Since it is developer machine there is nothing production on that server.
All email goes to single user no mater where it is going including local delivery.

| /etc/postfix/main.cf
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
 
luser_relay = [email protected]
 
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
 
myhostname = dev.k2patel.com
mynetworks_style = host
 
newaliases_path = /usr/bin/newaliases.postfix
 
queue_directory = /var/spool/postfix
 
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
 
smtp_tls_CApath = /etc/pki/tls/certs
smtp_tls_loglevel = 1
smtp_tls_note_starttls_offer = yes
smtp_tls_security_level = may
 
smtpd_banner = $myhostname ESMTP ready
 
prepend_delivered_header = forward
 
transport_maps = hash:/etc/postfix/transport

transport

Create New file which create the map for transporting email.
Please replace “vmail.k2patel.com” with whatever email server you want to deliver to.
I am using vmail.k2patel.com where my real [email protected] exists.

| /etc/postfix/transport
localhost :
dev.k2patel.com local:[email protected]
k2patel.com     smtp:vmail.k2patel.com
*       local:[email protected]

You need to create hashmap of this file use following command if you dont know how to.

/usr/sbin/postmap /etc/postfix/transport

Aliases

This is where all internal redirection happens.
Also make sure you specify all user you want redirected mail to.
carefull – check the k2patel user properly.

| /etc/aliases
# Person who should get root's mail
root:           [email protected]
backup:         root
 
 
user1:     [email protected]
user2: [email protected]
k2patel:        [email protected]

Also you need to rebuild alias database please use following command if you dont know.

/usr/bin/newaliases
Test your mail any email it should get in your inbox.
dev_cache_all.txt · Last modified: 2011/07/27 10:56 by k2patel
{"cc_re__cc_re__cc_by_sa_4_0": ["ns [O]\"><span>Old revisions</span></a></li><li><a href=\"/dev_cache_all?do=backlink\" class=\"action backlink\" rel=\"nofollow\" title=\"Backlinks\"><span>Backlinks</span></a></li><li><a href=\"#dokuwiki__top\" class=\"action top\" accesskey=\"t\" rel=\"nofollow\" title=\"Back to top [T]\"><span>Back to top</span></a></li> </ul>\n</div>\n</div>\n</div> \n \n<div id=\"dokuwiki__footer\"><div class=\"pad\">\n<div class=\"license\">Except where otherwise noted, content on this wiki is licensed under the following license: <bdi><a href=\"http://creativecommons.org/licenses/by-sa/4.0/\" rel=\"license\" class=\"urlextern\">CC Attribution-Share Alike 4.0 International</a></bdi></div>\n<div class=\"buttons\">\n<a href=\"http://creativecommons.org/licenses/by-sa/4.0/\" rel=\"license\"><img src=\"/lib/images/license/button/cc-by-sa.png\" alt=\"CC Attribution-Share Alike 4.0 International\"/></a> <a href=\"http://www.dokuwiki.org/donate\" title=\"Donate\"><img src=\"/lib/tpl/dokuwiki/images/button-donate.gif\" width=\"80\" height=\"15\" alt=\"Donate\"/></a>\n<a href=\"http://php.net\" title=\"Powered by PHP\"><img src=\"/lib/tpl/dokuwiki/images/but", "<li><a href=\"#dokuwiki__top\" class=\"action top\" accesskey=\"t\" rel=\"nofollow\" title=\"Back to top [T]\"><span>Back to top</span></a></li> </ul>\n</div>\n</div>\n</div> \n \n<div id=\"dokuwiki__footer\"><div class=\"pad\">\n<div class=\"license\">Except where otherwise noted, content on this wiki is licensed under the following license: <bdi><a href=\"http://creativecommons.org/licenses/by-sa/4.0/\" rel=\"license\" class=\"urlextern\">CC Attribution-Share Alike 4.0 International</a></bdi></div>\n<div class=\"buttons\">\n<a href=\"http://creativecommons.org/licenses/by-sa/4.0/\" rel=\"license\"><img src=\"/lib/images/license/button/cc-by-sa.png\" alt=\"CC Attribution-Share Alike 4.0 International\"/></a> <a href=\"http://www.dokuwiki.org/donate\" title=\"Donate\"><img src=\"/lib/tpl/dokuwiki/images/button-donate.gif\" width=\"80\" height=\"15\" alt=\"Donate\"/></a>\n<a href=\"http://php.net\" title=\"Powered by PHP\"><img src=\"/lib/tpl/dokuwiki/images/button-php.gif\" width=\"80\" height=\"15\" alt=\"Powered by PHP\"/></a>\n<a href=\"http://validator.w3.org/check/referer\" title=\"Valid HTML5\"><img src=\"/lib/tpl/doku"]}