mail forwarding and replies not working

JaimeCameron wrote:

These tell procmail to always deliver to users' mailboxes, and never run their .procmailrc files. To change this in Virtualmin, click on the Module Config link on the left meny, go to the 'Spam filtering options' section and change 'Allow mailbox users to configure procmail?' back to 'Yes' (the default). Then click Save, and then the button to re-check the Virtualmin configuration.

Jaime, I am unable to find ‘Spam filtering options’ or the ‘Allow mailbox users to configure procmail’ section under Virtualmin > Module Config. Has this been changed or is it located elsewhere? It looks as though I am having the same problem of it bypassing user’s specific procmail recipes. Thanks!

It has been moved in newer Virtualmin versions - you can now find it at Email Messages -> Spam and Virus Scanning.

I also have a problem with usermin autoreply. It seems the ‘mail forwarding and replies’ works on some of my domains but on others it just doesn’t work- nothing appears to happen; ust the mai lgoes into the mailbox as normal.

I read above that the ‘filter and forward’ function is the preffered method. This works on the domains that have problems with ‘mail forwarding and replies’ except that the mail comes from <username>.<userdomain>@<myservername>.com instead of <username>@<userdomain>.com

Any ideas how to either fix the autoreply email address or how to get ‘forwarding and replies’ working on all domains?

-----------contents of /etc/procmailrc----------------------
LOGFILE=/var/log/procmail.log
TRAP=/etc/webmin/virtual-server/procmail-logger.pl
:0wi
VIRTUALMIN=|/etc/webmin/virtual-server/lookup-domain.pl $LOGNAME
:0

  • ?/usr/bin/test "$VIRTUALMIN" != ""
    {
    INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN
    }
    ORGMAIL=$HOME/Maildir/
    DEFAULT=$HOME/Maildir/
    DROPPRIVS=yes
    :0
    $DEFAULT

-----------end of contents--------------------------

------------contents of /home/freshtel/homes/fred/.procmailrc---------------
:0
| /etc/usermin/forward/autoreply.pl /home/freshtel/homes/fred/autoreply.0.txt fred.freshtel

-----------end of contents--------------------------

I thought i fixed it when i discovered that .procmairc referenced /etc/usermin/forward/autoreply.pl and this script didn’t exist. but as I mentioned above coping this file from /usr/share/usermin/forward didn’t fix it.

Thanks again for looking into this.

That script is important, and actually should be created when you enabled spam for a domain in Virtualmin. It is a wrapper around the one in /usr/share , so you can’t just copy it across…

You should instead replace it with :

#!/usr/bin/perl
open(CONF, “/etc/webmin/miniserv.conf”);
while(<CONF>) {
$root = $1 if (/^root=(.*)/);
}
close(CONF);
$ENV{‘WEBMIN_CONFIG’} = “/etc/webmin”;
$ENV{‘WEBMIN_VAR’} = “/var/webmin”;
chdir("$root/virtual-server");
exec("$root/virtual-server/lookup-domain.pl", @ARGV);

and then run :

chmod +x /etc/webmin/virtual-server/lookup-domain.pl

Jamie,

Thank you for your help. I’ve now got automatic replies working using the “Filter Mail” module in Usermin. This does the job, however it’s missing a lot of the features of the standard vacation program that can be called by sendmail. Of particular note is that vacation will not keep autoreplying to the same sender, apparently has some intelligence about not replying to mailing lists, and has a number of variables that can be included in messages. Given the choice, I’d rather use the vacation module if possible.

According to an associate of mine, the .forward file would likely work on the server if I had not chosen the “username@domain.tld” format for my user accounts. Preliminary tests indicate he’s right–I’ve got a test domain setup for mucking around with, and I changed the format of the mailboxes to username.domain, edited the .forward file so it looks like this:

\christest.domain.tld
"|/usr/bin/vacation christest.domain.tld"

And then sent an email to that account. I got a bounce back that contained the following:

----- The following addresses had permanent fatal errors -----
"|/usr/bin/vacation christest.domain.tld"
(expanded from: <christest@domain.tld>)

----- Transcript of session follows -----
550 5.7.1 /home/domain.tld/homes/christest/.forward: line 2: “|/usr/bin/vacation christest.domain.tld”… User christest.domain.tld@mail.ourserveraddress.com doesn’t have a valid shell for mailing to programs

The shell for the user is ‘/dev/null’, the default, which is obviously not valid. For testing purposes, I have changed the test user’s shell to /bin/false and got the following entry in /var/log/maillog:

Jul 27 07:07:23 devel sendmail[852]: l6RE7Jgp000852: from=<itdept@ourserveraddress.com>, size=349, class=0, nrcpts=1, msgid=<46A9FC07.4040906@ourserveraddress.com>, proto=ESMTP, daemon=MSA, relay=S010623748432.vs.shawcable.net [70.71.32.10]
Jul 27 07:07:24 devel sendmail[871]: l6RE7Jgp000852: to=\christest.domain.tld, delay=00:00:01, xdelay=00:00:00, mailer=local, pri=120349, dsn=2.0.0, stat=Sent
Jul 27 07:07:24 devel sendmail[871]: l6RE7Jgp000852: to="|/usr/bin/vacation christest.domain.tld", ctladdr=<christest@domain.tld> (2041/501), delay=00:00:01, xdelay=00:00:00, mailer=prog, pri=120349, dsn=2.0.0, stat=Sent

Almost working, but no autoreply was actually sent. We’re close, very close, but something just isn’t quite right. Not sure what.

Another issue comes up if I give the users a valid shell: they can now FTP to their home dirs, which is something I’d rather they not be able to do.

Do you know of any workaround to this problem with .forward files not being read by sendmail if the user’s account is in the format “username@domain.tld”?

Thanks,
Chris