Quick Email Aliases on Media Temple

The Short Story:

If you have a Media Temple (dv) vps server account with Ruby1 installed and root/sudo access, you can use my handy-dandy script to create instant email aliases for any of your hosted domains.


sudo ./alias.rb email_alias@hosted-domain.com recipient@anydomain.com

That’s it. 5 seconds and you have a new email alias. No Plesky mess involved.

I even aliased my alias script in my .bashrc file:

alias ealias='sudo ~/alias.rb'

The Backstory (and how the script works):

I use a lot of email aliases. I rarely give out my real email address. I usually create an alias that forwards to my real address. For example, if Amazon.com thinks my email address is amazon (@ my domain.com). That way, if I ever start getting spam, I know who gave away my address, and I can just delete the alias.

I use Media Temple’s Dedicated Virtual (dv) hosting plan. The Plesk control panel is kinda limited (and a pain) when it comes to creating lots of email aliases. I’ve yet to find a way to create an alias that forwards to an external email address, and any alias creation takes a crapload of mouse clicks. So, I decided to figure out a simpler way. After looking under hood, I discovered qmail. I didn’t know a thing about qmail, but I was willing to do some research to get to a solution for my alias thing. It turns out, qmail has kind of a neat way of dealing with aliases: for each domain, there is a directory. Each file in this directory represents an email alias3. The files are named thusly: ‘.qmail-alias’ where alias is the actual name part of the alias address. The contents of the file consist of the actual recipient addresses (prefixed by & and separated by newlines). So, a file called .qmail-amazon in /var/qmail/mailnames/postpostmodern.com that contains my real email address, prefixed by an ampersand, would be all that is needed for a functioning alias. All my script does is parse the input to figure out the name of the file, the contents of the file and where to put the file. Then, of course, it just creates the file.

The nice thing about qmail’s system is that the files are utilized instantly. There is no reloading of alias info or anything. It just works.

Oh, and adding a bash alias like this:

alias emails='sudo ls -a /var/qmail/mailnames/hosteddomain.com/'

will give you a list of existing aliases.

  1. Yes, I could have used Bash or something, but I’m more comfortable with Ruby, okay? ↑ back up there
  2. Please adjust the shebang line for your ruby installation. And don’t forget to chmod the script so it’s executable (755)! ↑ back up there
  3. There are also subdirectories for each real email account. ↑ back up there

comment feed And the ensuing discussion…

  1. 1

    Nov 29th, 2006 at 9:20 am Shaun Inman

    Nice tip. Does Plesk reflect these additions or is it oblivious to the new aliases because they’re added outside of its system?

  2. 2

    Nov 29th, 2006 at 10:57 am Jason

    @Shaun - Plesk is oblivious. I think Plesk keeps all of its info in a MySQL database.

  3. 3

    Dec 11th, 2008 at 9:46 am Tommy Cutter

    Jason, nice article. I have been doing some research on the subject and saw that Plesk has some a nice CLI for some of their control panel related tasks. That way, you can add aliases and they’ll still show up in the web control panel later on.

    Here’s a link to the mail section of the pleask CLI documentation.

  4. 4

    Dec 11th, 2008 at 9:47 am Tommy Cutter

    By the way, I tried posting that link with the http and it failed, just gave me a blank page. In case you weren’t aware…

  5. 5

    Dec 11th, 2008 at 11:04 am Jason Johnson

    @Tommy - Thanks for the info. I don’t use Plesk at all anymore, but it’s good to know.

    As for the link. Not sure what went wrong there. Sorry about that. I’m still working out some kinks in the comment formatting. I’ve fixed your link.

  6. 6

    Feb 4th, 2009 at 12:42 am Siba

    Hi, Thanks, this is nice solution. I am using a domain where the email alias is not supported. But i want to forward a email ID to multiple email IDs as this is required. So how do i do it. Please help

  7. 7

    Feb 8th, 2009 at 10:57 pm Jason Johnson

    @Siba – You should be able to add multiple lines in the alias file. Each line should list an email address preceded by an ampersand (&).

Comments are closed.

Additional Resources







Recent Instructional Articles

Slicehost (and Linode) LAMP Cheatsheet


A quick list of steps I use to set up a LAMP server on Slicehost or Linode.

Terminal Tip: Prevent Creation of Mac Dot Files


An environment variable can prevent creation of ._filename files.

Terminal Tip: Delete Those Mac Dot Files


Use the find command to delete all of the ._* and .DS_Store files.


Recent Editorial Articles

More Usable Mac: Finder Toolbar


I find it useful to keep a few extra items in my Finder toolbar.

No Multiple-Class Support in IE6


IE6 doesn’t respond to multiple class selectors.

New Skin for the Old Blogish


This blogish is finally back online after an extended period of http silence.


Recent Downloadable Articles



Gitup + Transmit = Really Simple Publishing

Leopard-Style iTerm Icon, Take 2


The newer, bluer version of the iTerm icon.

Leopard-Style iTerm Icon


An updated, Leopard-style icon for iTerm.

About This Site

About the Author

That’s me in the photo above. My current profession is web development. Therefore, it is the subject of this site.


Postpostmodern is the name of this site and my alias on most of the web. There's nothing really special about the name Postpostmodern. I studied art in college during the years after postmodernism, and nobody knew how else to classify the state of things other than silly words like postpostmodernism.

Sorta Blogish

I'd call this a blog, but I don't feel it fits the 'log' format. My goal is to publish articles on web-related topics that interest me, and while some articles may be time-sensitive, I would prefer that the organizational focus be on the categories and tags rather than chronology.

More Me

More about me can be found on the about page. Or, look me up in the usual places: