The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Email Piping to PHP with CATCH ALL

Discussion in 'cPanel Developers' started by zeeshanhashmi, May 29, 2010.

  1. zeeshanhashmi

    zeeshanhashmi Member

    Joined:
    May 29, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hello Masters,

    I have a problem and i need some help / guidance in order to solve the issue.

    First, let me try to explain the requirements :

    I have a site, where the office staff can send email to mobile users on their CELL NUMBER email address (like, 83838388@txt.att.net). The email/txt to the mobile user will be sent like office_staff_name_talk_1@domain.com

    Now you can see that there will be the name of the office staff with the TALK 1, that is the specific talk from that staff to the particular mobile user.

    Now, what I think is that, instead of having so many email addresses for each staff, why not just have 1 Catch all email address, and whenever some one send an email to office_staff_name_talk_1@domain.com, it will be forwarded to the catch_all_email@domain.com

    Is this possible ?

    Now, when the catch_all_email@domain.com receives the email that was send to office_staff_name_talk_1@domain.com, the email will be PIPE to a PHP script that will determine the original recipient (i.e.office_staff_name_talk_1@domain.com) and notified the same staff that there is a reply from the mobile user.

    Now, please tell me is that all doable and can be done like i mentioned ?

    Is there any other way to do this ?

    I have CPanel, and i want to know if catch all for above scenario and piping for above scenario is possible

    Thanks
    ZH
     
  2. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    You could but why would you want to? :rolleyes:

    You are substantially increasing your work as well as the mail server processing and loads by doing it that way.
     
  3. zeeshanhashmi

    zeeshanhashmi Member

    Joined:
    May 29, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hi

    Thanks for your reply. How you would suggest me to do it instead ?

    Actually, when a staff sends a message, it will open a communication window, and as soon as the mobile user reply ONLY that window will update instantly.

    Now, if I do not do the way i described, how i can do ?

    thanks
    Zeeshan Hashmi
     
  4. zeeshanhashmi

    zeeshanhashmi Member

    Joined:
    May 29, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Well, so no one at this Forum can provide guidance / help ?
     
  5. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,447
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Please keep in mind this past weekend was a long holiday weekend for some.

    I'm not sure I understand the question, but you can if you like, create forwarders instead of actual email accounts easy enough from your cPanel.

    staff1@yourdomain.com, staff2@yourdomain.com etc, and have them all be forwarded to staffadministrator@yourdomain.com (this one being the valid email account)


    But, the title of your thread:
    suggests that you might be wanting something different than your actual post content reads to me.

    If you can explain it a bit differently or with more details I am quite sure you'll find the help you seek.

    Everyone is back to work today. ;)
     
  6. zeeshanhashmi

    zeeshanhashmi Member

    Joined:
    May 29, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hi

    Thanks for your reply,

    Well, your understanding is almost correct.

    Yes i will make a master/actual email addresses like all_staff@website.com, and all the other email addresses, staff1@website.com will be forwarder to all_staff@website.com.

    But, here are the other part of the requirements,

    1) all such non-actual email address, like staff1@website.com etc, will me made in the real time by the script.

    2) Whatever email is coming to all_staff@website.com, i want that email to be PIPED to my PHP Script.

    Now, tell me, is this all ok and achievable ?
     
  7. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Sorry was offline Monday and a bit busy yesterday just like InfoPro said ....

    Setting up what you ask is ridiculously easy ---

    The point I was making in the last post is that by blindly piping every inbound email to script with wildcard matching you are going to have large numbers of extra script launches using up server resources and processing space for child processes just simply handling spam messages. Other than potential DoS type situations, you also open yourself up to a number of other potential security problems doing that.
     
  8. zeeshanhashmi

    zeeshanhashmi Member

    Joined:
    May 29, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Well, thanks for your reply.

    In fact, this is going to be a 2 way REAL TIME communication on site.

    Like the online staff, will send a message to mobile user, and then mobile user will send the message to the staff email address and that will update the communication window live.

    Now, what would you suggest a better way for this ? if not email piping ?
     
  9. zeeshanhashmi

    zeeshanhashmi Member

    Joined:
    May 29, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hellooo uuuu hoooooo


    any 1 ????

    No one here who can help ?
     
  10. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    You could always have a PHP script based on http://sdk.cpanel.net/lib/xmlapi/php/cp_xmlapi_php_v1.0.5.tar.gz that creates the email forwarders in real time, making cPanel do all the work of forwarding, without setting up a catch-all piping program. When you're done using a forwarder, you could always manage them via the cPanel interface or build your own script to handle mass deletions.

    Would it be okay if I move this thread over to Developer Discussions so those that work with our APIs can further assist you with pursuing this particular solution?
     
  11. zeeshanhashmi

    zeeshanhashmi Member

    Joined:
    May 29, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hi

    thanks for your reply, and yes I think you can move this discussion to the relevant forum.

    thanks
    ZH
     
  12. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi ZH,

    I guess you could do it like DavidG suggests.

    1)a email with is prepared with a unique id related to the task
    2)a forwarder is added via the xml-api (possibly using the PHP client class DavidG pointed to)
    3)the email is sent, with the "from" and "reply-to" address the same as the new forwarder
    4)mobile user sends a reply to email
    5)email get forwarded to "catch_all" box
    6)"catch_all" pipes a copy of all incoming email to a script that will update the task status, etc
    7) the script also checks for any old forwards and removes them (in the opposite manor they were created, ie. xml-api); updates their task status if necessary.

    Another way would be to sent and receive all the mail from the "catch_all" address and place the task id in the subject line. It's easier to implement cause all you need is the task creation/maintaince script and the script that is on the other side of the pipe (all of which you'd have to write anyway). If you did do it that way, I'd recommend putting the id (ex. [[TKT#A123456]] ) at the END of the subject.

    I personally can't stand how automated mail queues insist on placing this giant unique id at the beginning of the subject. On a mobile device, you always have to open the email or at least the email client, to get a glimpse at what the darn things is even about! Totally negates any mobile notification screens...sigh.

    Good Luck,
    -DavidN
     
Loading...

Share This Page