It is not a php issue, it is more a configuration issue for your mail server, most of them use the .forward file to manage email forwarding. You can use the file functions (http://uk.php.net/manual/en/ref.filesystem.php) to read and write this file.

It should be fairly simple.

Start with

<?php
echo file_get_contents("/home/yourname/.forward");
?>

then read and write this file (it should contain your forwards already), assuming they are using sendmail like email server

You may have read/write permission errors, depending on how the server was configured.

Mike

Matt Palermo wrote:
I have a hosted website which uses CPanel.  I can login to CPanel and create
as many email forwarders as I want.  Is there a way I can write a PHP script
to manage these email forwarders?  For example, somebody registers on my
site and they want to be added to the for a certain email address (as an
email forwarder).  How would I write a script that could access this email
forwarders file and insert a new address to it (or delete one if that is the
case)?  Does anyone know if this can be done.  I am trying to use these mail
forwarders as a moch mailing list, so when an email is sent to a specific
address, it will automatically be distributed to everyone on the forwarding
list.  Please help if you have any ideas or suggestions.

Thanks,

Matt
http://sweetphp.com

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to