The best way to do this is to have the email address point at a PHP script.
Let's assume that your domain is foo.com. Let's also assume that you have a big company with lots of people using addresses like john@foo.com, betty@foo.com, and accounting@foo.com. If your aliases were to be "something" @ foo.com, then you'd have to do some clever sendmail tricks to separate mail destined for a real address from an alias. To avoid that problem, set up a subdomain like resumes.foo.com. Then you can leave the foo.com mail alone since it's already working fine.
Set up an MX record (or have your hosting company set that up) for resumes.foo.com to point to your server. Then set up a program like Postfix or Sendmail to point <anything> @ resumes.foo.com to a PHP script. This way, any incoming mail will be received by your PHP script.
Your PHP script should then do the following:
- Read everything before the @ sign. Put this in a variable called $recipient
- Find the Body of the incoming mail and store in a variable called $body
- Have the PHP script look up the user's real email address based on $recipient. For example:
$query = "select email from users where alias_code='" . mysql_real_escape_string($recipient) . "'";
Now the PHP script knows their real address.
- Then use the mail() command to send an email to the user like this:
To: $email
Hi, You have had a response to your resume. They said:
$body
When you are picking codes for the aliases, do NOT use sequential numbers. For example, this would be bad:
1000001@resumes.foo.com
1000002@resumes.foo.com
1000003@resumes.foo.com
because a disreputable employer could easily send mail to every single one of your customers. Instead, generate a 10 character random string like this:
4jems95jwe@resumes.foo.com
am349dww75@resumes.foo.com
8u3e7vyfh4@resumes.foo.com
If your PHP script doesn't find that alias in the database, simply dump the email.