Testing emails in your local vm

testing emails can be tricky because you dont really want to send emails to real users. So we really need to turn emails service on and off as and when needed.

To stop postfix:
– stop postfix in rc.x so that it doesnt boot up with postfix started.
– /etc/init.d/postfix stop (to stop postfix if it is running now)

when you need postfix, delete queue first

check mail queue with “mailq”. then delete all the queues:
# postsuper -d ALL
# postsuper -d ALL deferred

now start postfix “/etc/init.d/postfix start” and do all your testing. when done, remember to turn postfix off again with “/etc/init.d/postfix stop”

Author: bpeh

Bernard Peh is a great passioner of web technologies and one of the co-founder of Sitecritic.net Website Design and Reviews. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP programming.