Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

To create a test email server, I have a similar requirement as:


But I need to send all the emails to an external account, not a local one.

I would like to do something like:

  • xyz:email@gmail.com

but xyz is not local nor smtp.

share|improve this question

2 Answers 2

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 :

touch /etc/postfix/virtual && postmap /etc/postfix/virtual


share|improve this answer
Thank you Mattias Ahnberg for your answer, How about sending multiple mails to the machine with postfix installed with one unique email address (gmail for example)? I can only receive the 2-3 first mail , the rest is bounced. –  postmaps Jun 1 '13 at 20:13

Is it acceptable to just have it go to a local account that then forward all mail to your external address? You could get it running like the other question you mentioned, and then use procmail to have the messages forwarded and then deleted locally. Something like this would probably do the trick by replacing the folder with /dev/null.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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