Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Programatically creating e-mail forwarders

Discussion in 'E-mail Discussion' started by MajSeph, May 4, 2012.

  1. MajSeph

    MajSeph Registered

    Joined:
    May 4, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Website Owner
    This will be a fairly big post, I will try explaining what I am trying to accomplish and the hurdles I've been having.

    Goal: To be able to create en e-mail forwarder through PHP

    Problem: I do not have root access, the hosting company does, they just happen to have cPanel.

    What I've tried:

    I've been going through various resources on the forums here, trying them one at a time and seeing what works.

    - The first thing I tried was: http://forums.cpanel.net/f42/php-script-generating-forwarders-programmatically-115569.html

    But without root access I could not put it where it was needed.

    - Then I read through: http://forums.cpanel.net/f42/xmlapi-php-class-111897.html

    Tried implementing it with:

    PHP:
    include_once "xmlapi.php" ;
    $ip 'mysite.ca';
    $root_pass 'accountPassword';

    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth("accountUsername"$root_pass);

    $xmlapi->set_debug(1);


    $p['domain']    = 'mysite.ca';
    $p['email']        = 'testUser@mysite.ca'
    $p['fwdopt']    = 'pipe';
    $p['pipefwd']    = '/home/accountUsername/public_html/parsingScript.php';

    $res $xmlapi->api2_query('accountUsername''Email''addforward'$p);

    var_dump($res);  
    I replaced the variables and values for the purpose of the explanation, such as accountUsername, accountPassword, mysite.ca and parsingScript.php

    Which failed drastically, for what I'm assuming is the lack of root administration password.

    -----

    This site is being done under a shared hosting domain, so I don't imagine getting root access in the near future. What are my options? When I asked this question to the hosting providers they seemed to believe I needed a better php coder ...

    What can I do in order to have forwarders created automatically that will not require root access on my part?
     
  2. MajSeph

    MajSeph Registered

    Joined:
    May 4, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Website Owner
    Is this the right forum to post this under?
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice