Pipe To Script Help (User Level Filtering)

Asked by:
gilhar5 / 8 Points
Time:
2013-06-14 1:44 am EST
Category:
Cpanel
Hits:
941
Hello. I am trying to setup User Level Filtering to pipe to a perl script, which I hope will filter my email the way I wish. I would like the script to either send it to my inbox or send to a folder based on the processing in the script.

At this point I am trying to get any email with subject containing the word "filter" to be sent to the script for processing.

My current rule is:
Subject, Contains, filter
Pipe to a program, public_html/cgi-bin/stuff-filter.pl

I get a bounce back email which says:


This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

pipe to |public_html/cgi-bin/stuff-filter.pl
generated by g@mydomain.com
(ultimately generated from stuff@mydomain.com)

------ This is a copy of the message, including all the headers. ------

Return-path: <gil@mydomain.com>
Received: from c-71-196-164-166.hsd1.co.comcast.net ([71.196.164.166]:54094 helo=[192.168.0.102])
by ehub29.webhostinghub.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256)
(Exim 4.80)
(envelope-from <gil@mydomain.com>)
id 1UnF56-0008FY-Bm
for stuff@mydomain.com; Thu, 13 Jun 2013 17:29:20 -0400
Message-ID: <51BA39A7.9080806@mydomain.com>
Date: Thu, 13 Jun 2013 15:29:11 -0600
From: Gil Harari <gil@mydomain.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
MIME-Version: 1.0
To: stuff@mydomain.com
Subject: filter test hbd1
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

To ask this user for more information, please first login.

To submit an answer, please login.

By the way, I am not asking for help with writing the script, but it seems to me that the script is not being triggered.

Also, it is unclear to me what user the script will run as and what permissions are necessary to, for example, write to a logfile.
gilhar5
8 Points
2013-06-14 02:12 am EST

ANSWERS

0

arnelc
Staff
17,314 Points
2013-06-14 2:44 am EST
Hello Gilhar5,

Sorry to hear you're having problems with the custom email filtering. I did a little research and came across this post in the cPanel forums: Can't get email to pipe to PERL script. I went ahead and added the following to valiases as per the post:

stuff@mydomain.com: "|public_html/cgi-bin/stuff-filter.pl"

I did replace "mydomain.com" with your actual domain name.

You do not unfortunately have access to edit that file directly, so you will need to send a request into technical support to have it changed. For your convenience, I have changed it here in hopes of correcting the behavior you're seeing. Basically, the forwarding has to be setup to forward it to the script. Any request to have this done through technical support would be done privately and securely - they do however request verification of the account with either the last 4 digits of the credit card on the account or the AMP password.

I hope this helps, please let us know if you require any further assistance.

Regards,
Arnel C.

To submit a comment on this answer, please first login.

So, does this mean ALL of my mail to "stuff" will be piped to the script? If so, this is not what I wanted. Also, whatever way I decide to filter this, I need to have control via control panel. Is there a way to make cpanel behave like it is supposed to, with user control of the pipes according to matching condition? Maybe I am misunderstanding.
gilhar5
8 Points

2013-06-14 4:57 am EST
Hello gilhar5,

The pipe to program option, must be setup for each individual email. When you pipe an email to a script, every email will go through the script, then you must code it to handle the mail as needed.

There is also a User level filtering button in the cPanel under Mail, if you just want to create email filters.

We are happy to set the pipe to program option on the server for you, since it is not accessible on a shared account.

Your original error stated:
(ultimately generated from stuff@mydomain.com)

Arnel edited this file on the server: /etc/valiases/domain.com, as per the cPanel article he linked to previously. This will allow you to pipe email to a perl script for that specific email address only(stuff@).

I then see you contacted Alicia in Live Tech Support and requested that she set valiases to default, which deletes all email forwarders in cPanel.

If you don't want to pipe that email address to a perl script, Tech Support should have just removed this line from the domain's file in valiases:
user@domain.com: "|/path/to/perl/script/file.pl"

Tech support would have to do this to

Sorry for any confusion that may have occurred. If you have any further questions, feel free to post them below.
Thank you,

-John-Paul
johnpaulb-whh2
12,339 Points
Staff
2013-06-14 7:58 pm EST
Want to share this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}