Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have setup an Ubuntu 12.04 VM, which I use to test and develop magento shops. On this desktop VM I have an almost exact copy of the shop running. I prefer to use a desktop VM as this gives me the option to run a browser inside the VM and keep everything local. If I want to I can modify the hosts file and route shop domain names to localhost.

I would like to be able to test mail functionality. To give an example: for an existing shop some mails are not sent. Instead of messing with the production site, I want to test this on the VM. If mails are sent here, the mail should stay on the VM and not be sent out over the internet. So I want to be able to send the mail out from magento, but the mail stays local. And I want to read the mail, preferrably with a mail client like Thunderbird.

I have blocked traffic to port 25 using UFW, so I hope this prevents mail from leaving the VM.

ufw deny 25/tcp

I have worked with postfix and prefer that as smtp server, but I can't say (at all) that I'm experienced. I hope this is not too complex to setup.

Why not test with my own mail or test address? Well that might be a solution, but on a running magento install mail might be sent out automatically to other people. As I use a copy of the production database, with real customers and existing addresses, I don't want them to receive status update mails from the test system. If the solution only works for one or two domains or mail addresses, that's fine.

share|improve this question
    
Could the VM be denied internet access from the router/gateway? That would prevent emails from leaving the local network while still letting the VM communicate with the local network. – killermist May 29 '13 at 11:25
up vote 1 down vote accepted

It appears that postfix can be configured for local-only delivery by tweaking the /etc/postfix/master.cf file

http://www.opensourcery.com/blog/chad-granum/local-only-postfix-testing

share|improve this answer
    
This seems very easy and I have installed postfix like this. Now I have to test it. – SPRBRN May 29 '13 at 15:30
    
Works perfect! Thanks! – SPRBRN May 30 '13 at 11:53

If you have sendmail available, you could have a simple mailertable map in the form:

.           local:mycatchall

This would route all mail to the local account 'mycatchall'

You could optionally precede this with a line like:

mydomain.com            esmtp:[mail.mydomain.com]

Which would forward all mail for your own domain to your normal server.

With Postfix, you could use the canonical maps feature.

I think you'd need something like:

/^.*$/        mycatchall@mydomain.com

Of course, you need to enable whichever maps you use in the main config file.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .