Directly editing e-mail aliases

I would like to be able to directly control multiple e-mail aliases without going through the web-based control panel. My end goal is to create a PHP script that can add or modify mail forwarding (that is, set up forwarding from to, through my own web site).

I haven’t been able to figure out where this forwarding information is stored on the server (doesn’t seem as simple as one .forward file). However, in the “addresses” section of the web-based control panel, there is an option to “bulk edit your forwarding-only addresses.” All of that information appears to be coming from one file… is that true, and if so, where is that file?

Is there any text file anywhere on the server that I can easily modify with a PHP script to add or modify all e-mail aliases?

I don’t imagine this is very complicated, but I haven’t been able to figure it out on my own yet, so I would greatly appreciate any help!

IIUC you can do this using .procmailrc:

Well, I already have e-mail aliases set up, but they aren’t listed in the .procmailrc file. Would be nice if they were all in one place. Also, I’m a little concerned about having a PHP script on my Web site constantly rewriting my .procmailrc file, perhaps even multiple times as day (as people update their mail forwarding address). Any other ideas?

[quote]I already have e-mail aliases set up, but they aren’t listed in the .procmailrc file.


No surprise, since as the KB says “Procmail isn’t used as the LDA anymore”. Surprised though that you /found/ a .procmailrc file! :wink:

[quote]I’m a little concerned about having a PHP script on my Web site constantly rewriting my .procmailrc file


You have some choice, implies KB:

you will need to pipe your mail through procmail. To do this, create a file
(in your home directory) called “.forward.postfix”.

(Hmm… “.forward.postfix” looks worryingly implementation-specific for an interface element…)

That’s already done… but that still doesn’t really solve the problem I mentioned earlier (concern about a PHP script on my web site constantly rewriting my .procmailrc file, or some other file that it references, everytime someone’s e-mail forwarding address changes… that seems rather risky). Anyway, where are the existing aliases stored? I’m assuming that information is in some file, somewhere… would it be possible to create a script to directly modify that? Thanks for your help & suggestions…

It seems to me any solution wil necessarily have to write a file referenced by the mail server.

Sorry, I’ve no idea where the existing aliases are stored. If, as teh KB says, your .snapshots directory contains “full backups”, you should be able find a clue there.

This isn’t possible with our system. We could possibly set something like this up on a dedicated machine.

Some have mentioned using procmail. I would not suggest that… it’s a really kludgy solution, and doesn’t deal gracefully with a number of situations.

I think I’ve figured out a solution with procmail, but like you said, it’s not very graceful. Thanks for your help.

I would also implore you not to setup a system where anyone can sign up for a forwarding alias.

Definitely not what I’m doing, so don’t worry about it. Only I will be sending messages to the aliases (e-mail from any other account gets bounced) and it will only be to a limited group of contacts. I appreciate your concern, though!