This applies to CentOS 6. You may want to do this when testing some code and you’re not sure if it is going to send emails or not.
Edit /etc/postfix/main.cf
Add following lines at the bottom:
myhostname = localhost mydomain = localdomain inet_interfaces = $myhostname, localhost mydestination = $myhostname, localhost.$mydomain, localhost mynetworks_style = host default_transport = error:outside mail is not deliverable
Save the file then run the following commands (as root)
postfix upgrade-configuration postfix check newaliases
Test by mailing something to yourself
mail username@example.com
Check that it just gets put in the root mailbox
Enter the number of the email you want to read and it appears, d to delete it, z to return to the list, q to quit.