I have a dedicated server with MediaTemple. I’m searching for an efficient way to create email aliases programmatically in PHP.
The server has Plesk installed so I originally thought I could use the Plesk CLI to create an email alias that piped to a PHP script, but the only method I’ve found with the CLI is to create an email account.
My ideal situation is:
PHP script progammatically creates an email alias that forwards to a PHP script that handles email piping.
What I would like to know is some of the accepted methods of doing this. For instance facebook allows you to create a facebook email account alias that you can use to update your status and post photos by just sending an email to that account.
Thanks
I’ve done this, but not with Plesk.
You should be able to add aliases to your
/etc/aliasesfile, then you might need to runnewaliasesas a user with the correct privileges (I’ve done this as root; maybe you could cron it).The alias would look something like this:
mailhandler.phpneeds to be+x(chmod), and should probably start with#!/usr/bin/env php; from there you can read from thephp://stdinstream and parse the headers and/or body to do what you need.