1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice

Pipe incoming email to perl script

Discussion in 'Plesk for Linux - 8.x and Older' started by amendozav, May 4, 2005.

  1. amendozav

    amendozav Guest

    0
     
    How do I go about configuring one of my domains to be able to pipe incoming email to a perl script?

    Thank,

    amendozav
     
  2. dotnet

    dotnet Guest

    0
     
    Anyone out there...!?

    This would be really helpful for me as well. I have yet to be able to setup a pipe to a php script. I have been to many forums and got the basics but can't get it working, i find it hard to believe no one has done it, surely someone out there has passed an email to a script.

    I am using Red Hat Enterprise 3 and heres what I did:

    1: Login as root using ssh and cd to the mailnames folder.

    /var/qmail/mailnames/mydomain.com/errors

    2: Then I created a .qmail file called .qmail-errors in the errors directory.

    vi .qmail-errors

    3: Then insert the pipe on the first line of the file and save and exit.

    | php -q /home/httpd/vhosts/mydomain.com/subdomains/tickets/httpdocs/pipe.php

    4: Done, I have created a mail account that can receive email because i can receive it in a mail client, I have made a qmail file which passes the email onto the script and hey presto it should work! But it doesn't! :( & :confused:

    Any ideas out there? It is getting very frustrating after 5 days of searching and editing and double checking again and agin and again only to find the email is not getting passed to the script.

    Hope someone can lend a hand or some insight at least :D
     
  3. jamesyeeoc

    jamesyeeoc Guest

    0
     
    Have you tried renaming .qmail-errors to just .qmail ?

    (assuming 'errors' is an address, not part of a qmail mod)
     
  4. dotnet

    dotnet Guest

    0
     
    No luck... still not passing to script.

    Thanks James,

    I have tried what you said and to be honest thought that it was a good idea too once you mentioned it :) But alas, still no luck.

    Here's a thought though... I am loging onto the server as root with Putty OpenSSH. If i enable shell access for the domain does that mean i log on as the user that the domain is associated with and make the changes there. Would this make a difference?

    Cheers,
    Maarten
     
  5. jamesyeeoc

    jamesyeeoc Guest

    0
     
    I suppose it might, although probably not since you are root. Make sure all the u:g ownership is popuser:popuser on the qmail files.

    Are you getting the test mails kicked back to you, or do they disappear into a bit bucket?

    Any errors in any of the log files?

    You didn't specify what you were putting into the .qmail file, but it should be something like:

    | /path/to/the/script.pl

    right?

    Also just found another forum where someone posted that 'qmail needs executable perms to a pipe script, but Plesk sets 750 by default, so to try setting perms to 755 on the directory'

    Edit: Ok, it's not a perms issue

    I just tried a simple redirect to a script which all it should do is send me a simple email separately, and it's also not working. Strange..... I'll have to look at this later when I get a chance... I know I have done this on Plesk 6....
     
  6. Ryuma

    Ryuma Guest

    0
     
    to get email piping to work on plesk:

    1. create the mailbox in plesk.
    2. login to your server and go to /var/qmail/mailnames/"domainname"/"adress"
    3. open .qmail file with text editor and add : | preline /path/to/script
    4. change permissions for the script to 755

    that should get email piping working
     
  7. dotnet

    dotnet Guest

    0
     
    Still having issues

    Thanks Ryuma,

    I have implemented the settings you described, but I am still getting nothing in my ticket system.

    In another forum I have read that piping wont work if the email account in question is setup in plesk as a mailbox. Any ideas on this?

    Also, the email I am using to pipe from is on a different domain to the one hosting the pipe script. Do you know if this will affect it?

    I am starting to wonder if the path/to/script I am using is virtual and if there is another path that I should be using. I am currently using:

    /home/httpd/vhosts/domain.co.nz/subdomains/tickets/httpdocs/pipe.php

    Is this correct?

    Many Thanks
    Maarten
     
  8. Whistler

    Whistler Guest

    0
     
    Piping is working fine with qmail and Plesk.

    (one thing that really annoy me though - is the fact the the manual editing of the .qmail file is destroyed once in a while when Plesk rebuilds the mail files)

    If you want your support ticket system to work from a mailbox named support do the following:

    Create the mailbox as usual in Plesk.

    Edit the .qmail file in <path-to-plesk>/qmail/mailnames/<domainname>/<mailboxname>/.qmail

    Insert the piping info (for instance I use the following with Cerberus Help Desk):
    | /usr/local/psa/qmail/mailnames/gld.dk/support/cerberus_parser/cerberus-2.592.FreeBSD-4.9-RELEASE /usr/local/psa/qmail/mailnames/gl
    d.dk/support/cerberus_parser/config.xml FATAL /usr/local/psa/var/log/cerberus.log

    Then - if you want to leave a copy of the mail in your mail box also (in case the support software or piping fails) also put a:

    ./Maildir/

    at the end of your .qmail file.

    So my .qmail now looks like this:

    Code:
    | if [ -z "$SA" ]; then export SA=1; /usr/local/psa/bin/psa-spamc -f -u [email]support@gld.dk[/email] -U /tmp/spamd_full.sock > spamcheck$$; /usr/l
    ocal/psa/qmail/bin/qmail-local "$USER" "$HOME" "$LOCAL" "" "" "$HOST" "$SENDER" "$DEFAULT" < spamcheck$$; retval=$?; rm -f spamcheck
    $$; [ $retval = 0 ] && exit 99; exit $retval; fi
    | true
    | /usr/local/psa/qmail/mailnames/gld.dk/support/cerberus_parser/cerberus-2.592.FreeBSD-4.9-RELEASE /usr/local/psa/qmail/mailnames/gl
    d.dk/support/cerberus_parser/config.xml FATAL /usr/local/psa/var/log/cerberus.log
    ./Maildir/
    
    Hope this gives you a hint about what to do :)
     
  9. Ryuma

    Ryuma Guest

    0
     
    It's strange it doesn't work for you Maarten.

    The path to your script is correct, so it should work. if the path was not correct you should get a reply saying it couldn't find the pipe.php file.

    You can try to edit the .qmail file removing everything and leaving only the piping command.

    Also since it's a php script you can try to use this : | preline php -q -f /path/to/script

    If it's still not working try to reupload the pipe.php file and be sure to upload it in ASCII mode.

    And make sure the permissions on the pipe.php file are correct.
     
  10. sajeshvs

    sajeshvs Guest

    0
     
    Email piping is not working.

    Hi,

    To set piping to the mail support@domain.com we need to do
    the following

    vi /var/qmail/mailnames/domain.com/support/.qmail

    and then add
    |/home/httpd/vhosts/domain.com/httpdocs/support/admin/pop3pipe.php


    I have added the same but getting the following error

    Mar 2 04:41:06 server qmail: 1172810466.734480 status: local 0/10 remote 0/20
    Mar 2 04:41:06 server qmail: 1172810466.734486 end msg 5259615
    Mar 2 04:41:09 server qmail: 1172810469.757036 starting delivery
    5348: msg 5259605 to local 69-support@domain.comMar 2
    04:41:09 server qmail: 1172810469.757059 status: local 1/10 remote
    0/20
    Mar 2 04:41:11 server qmail: 1172810471.500736 delivery 5348:
    deferral: /bin/sh:_/home/httpd/vhosts/domain.com/httpdocs/support/admin/pop3pipe.php:_/usr/local/bin/php:_bad_interpreter:_No_such_file_or_directory/
    Mar 2 04:41:11 server qmail: 1172810471.500766 status: local 0/10 remote 0/20

    Now there is not emails are coming to ticket system. Thanks in advance for any help.

    Kind regards,
    Matt
     
  11. edacsac

    edacsac Guest

    0
     
    What the heck does "preline" mean??
     
  12. SamSim

    SamSim Guest

    0
     
    Remotely hosted email piping solutions

    Hi,
    There are a couple of remotely hosted email piping solutions that might save some time here. I would recommend checking out the following two services:
    http://mailhooks.com : Free basic service for parsing and email and posting the parts to a URL
    http://mailnuggets.com : Paid service that does the same thing, but also posts attachments, and sends emails in real-time. Has JSON option.
     
Loading...