Using exim with procmail?

johny1415

Registered
Mar 28, 2015
1
0
1
here
cPanel Access Level
Website Owner
I have a shared account from Hostgator. In order to be able to filter incoming mail with .procmailrc I added the following to my /etc/vfilters/<USERS>:

# Exim filter

# Auto Generated by cPanel. Do not manually edit this file as your changes will be overwritten. If you must edit this filter, edit the corresponding .yaml file as well.

if not first_delivery and error_message then finish endif

if
$header_from: matches ".*"
then
pipe "/usr/bin/procmail /home1/<USER>/.procmailrc"
endif
Truly, it looks quite strange. I have never had an opportunity to use Exim before. I don't want to use Exim native filtering because I already have a quite big list of procmail rules. Is this method of using procmail with Exim reliable or are there more recommended ones?
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hello,

This is not likely to work because procmail is not normally installed with cPanel. You may want to check with your hosting provider to see if there are any alternatives.

Thank you.
 

ottdev

Well-Known Member
Oct 1, 2013
139
7
68
cPanel Access Level
Root Administrator
Hello,

This is not likely to work because procmail is not normally installed with cPanel. You may want to check with your hosting provider to see if there are any alternatives.

Thank you.
Can I get a second opinion from cpanel ? I have a VPS and it is present - is it default/setting dependent or did my host install it manually?
/usr/bin/procmailrc
/usr/share/doc/procmail-3.22
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
If you have a VPS then you are welcome to install it if it's not included with your OS by default. Feel free to add the filter rule and let us know of the results.

Thank you.
 

ottdev

Well-Known Member
Oct 1, 2013
139
7
68
cPanel Access Level
Root Administrator
Yes, it works! I still wish to know if procmail is included standard in cPanel issue or dependent on what ?

Here is a simple test you can replicate:

In /etc/vfilters/mydomain.tld is code to make all email to my domain be subject to my procmail rules:
# Exim Filter
if $header_to: contains "mydomain.tld"
then
pipe " /usr/bin/procmail -a /home/myacctname/.procmailrc "
endif
In /home/myacctname/.procmailrc would be my specific procmail rules - the one test rule shown sends all email to a specific address into mailfolder called tmp:
SHELL=/bin/sh
PATH=/bin:/usr/bin
SENDMAIL=/usr/sbin/sendmail
VERBOSE=no
COMSAT=no
LOGFILE=$HOME/.procmail.log
MAILDIR=$HOME/mail


:0
* ^TO.*[email protected]
{
LOG = "Result of test: "
:0:
tmp
}
Results shown in /home/myacctname/.procmail.log :
Result of test: From [email protected] Wed Feb 24 09:57:00 2016
Subject: Test 2
Folder: tmp/msg.PbBoJ 27274
The message landed in /home/myacctname/mail/tmp/ folder

I will update this post once I have time to confirm that piping to a program via a procmail rule works as well.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
I still wish to know if procmail is included standard in cPanel issue or dependent on what ?
No, it's not included with cPanel by default.

Thank you.