#1 (permalink)  
Old 04-26-2009, 03:40 AM
Registered User
 
Join Date: Apr 2009
Posts: 1
organic is on a distinguished road
PHP Script generating forwarders programmatically

Hi there,

I'd like to programmatically add forwarder email addresses to a specific domain. I have an application that needs to give users a custom email address, and I'd like to append that address to the /etc/valiases/domain.com file.

I have full root/reseller/everything access to the machine, and I'm wondering what's the best way to do this? I'd prefer not to use suPHP.

What else can I do?

Thanks, Organic.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-27-2009, 12:11 PM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 7,995
cPanelDavidG is on a distinguished road
Quote:
Originally Posted by organic View Post
Hi there,

I'd like to programmatically add forwarder email addresses to a specific domain. I have an application that needs to give users a custom email address, and I'd like to append that address to the /etc/valiases/domain.com file.

I have full root/reseller/everything access to the machine, and I'm wondering what's the best way to do this? I'd prefer not to use suPHP.

What else can I do?

Thanks, Organic.
You could call the API2 function for adding an email forwarder via our XML API.

Code:
<?cp Email::addforward(email=EMAIL,domain=DOMAIN,fwdopt=FWDOPT,failmsgs=FAILMSGS,pipefwd=PIPEFWD,fwdemail=FWDEMAIL ?>
Where:

EMAIL = the portion of the email address (to be forwarded) before @. This parameter should never contain the @ symbol.

DOMAIN = the portion of the email address (to be forwarded) after @. This parameter should never contain the @ symbol

FWDOPT is fwd if forwarding to an email address, fail if you want to display a failure message, pipe if you want to pipe the email to a shell script in that cPanel account.

FAILMSGS is used if you selected to display a delivery failure message. This is the failure message that will be sent to the sender of the email.

PIPEFWD is used if you select to pipe to a shell script. This is a path to the shell script on the cPanel account that owns this email address.

FWDEMAIL is used if you select to forward to another email address. This is the full email address messages should be forwarded to.

For documentation on calling this from the XML API, visit: http://twiki.cpanel.net/twiki/bin/vi...ngAPIFunctions

If you prefer to use a pre-assembled PHP 5 class, check out Matt's code at: XMLAPI php class
__________________
Want our technical analysts to login to your server to assist you? You can contact our technical analysts at: http://tickets.cPanel.net/submit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-27-2009, 12:12 PM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 7,995
cPanelDavidG is on a distinguished road
** Moved to the Developer Forum **
__________________
Want our technical analysts to login to your server to assist you? You can contact our technical analysts at: http://tickets.cPanel.net/submit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:47 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© cPanel Inc