I use sendmail to manage the emails of my website. I'm testing features which require to send emails, and I'd like to receive these emails in a local directory of my server, store them as text files that I can read with vi for example.

I found a way to do this a few months earlier, the emails were stored in a specific folder with the recipient address as file name. Sadly, something went wrong with my virtual machine and I had to reconfigure the whole thing. The problem is that I don't remember what I had to do in order to get my emails in my local storage, and I can't find the solution again on internet, it makes me crazy. My virtual machine is on RHEL 6.

Thanks for your help !


Send the test e-mails to a local user, sendmail will deliver them locally, and you can read them as that user.

  • My question might be stupid, but how can I do that ?
    – Carrm
    Mar 3 '16 at 12:24
  • Usually, sending the mail to a user with a domain name (e.g. bob, or root) will result in it being delivered locally. It does depend on your sendmail configuration however. Mar 3 '16 at 12:30

I found how I did this the first time. It wasn't a sendmail configuration, but a piece of PHP code found here It doesn't even use sendmail anymore, sendmail path is replaced with the PHP code path in php.ini file. The emails are stored in a specific folder with the addressee's address + random characters as filename.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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