In my development PC I want to see all mail sent using PHP mail() function. Is there any dummy mail server that could show all sent mail (regardless of their recipient) and collect them in a mail box to preview?


Here you go: smtp4dev

Windows 7/Vista/XP/2003/2010 compatible dummy SMTP server. Sits in the system tray and does not deliver the received messages. The received messages can be quickly viewed, saved and the source/structure inspected. Useful for testing/debugging software that generates email.


phi's solution is great if you have a Windows environment.

If you have a Linux environment - then you can setup postfix to deliver all email to a local mailbox.

Here is a link to get you started - https://serverfault.com/questions/144325/how-to-redirect-all-postfix-emails-to-one-external-email-address

Create /etc/postfix/virtual-regexp with the following content:

/.+@.+/ email@gmail.com
Edit /etc/postfix/main.cf and add regexp:/etc/postfix/virtual-regexp to the virtual_maps configuration. The end result might look like this in main.cf:

virtual_maps = hash:/etc/postfix/virtual, regexp:/etc/postfix/virtual-regexp
Build the mapfile by typing:

postmap /etc/postfix/virtual-regexp
This also requires a virtual.db to exist. If it doesn't create an empty file called virtual and run : postmap /etc/postfix/virtual


Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.