mail forwarding and replies not working

26 posts / 0 new
Last post
#1 Thu, 07/19/2007 - 02:43
CaptainR

mail forwarding and replies not working

First, great job on the new virtualmin website. Simply excellent.

I'm trying to get the 'Mail Forwarding and Replies" usermin module to do what it's supposed to. I've got it installed and (allegedly) configured correctly but obviously, not quite.

When I make changes to the form, the module does update the .forward file in /home/domain.tld/homes/testuser and does create a file called "autoreply.txt".

Unfortunately, the system seems to ignore what's in the .forward and autoreply.txt files altogether. As far as I can tell, there are no log entries made that might even give a clue as to what's happening.

How can I troubleshoot this?

Sat, 07/21/2007 - 06:34
gregc@netoverdr...

Hi,

I have the same problem and would like help also. Nice to know i'm not the only one.<br><br>Post edited by: gregc@netoverdrive.com.au, at: 2007/07/25 14:25

Wed, 07/25/2007 - 14:23 (Reply to #2)
gregc@netoverdr...

I am using the 'setup mail filter' option

i've included the rule i configured.

postfix logs are
Jul 25 22:22:07 localhost postfix/qmgr[31479]: DC661BEE94: from=<gregc@netoverdrive.com.au>, size=386, nrcpt=1 (queue active)
Jul 25 22:22:07 localhost postfix/local[24363]: DC661BEE94: to=<fred-freshtel.com@localhost.localdomain>, orig_to=<fred@freshtel.com>, relay=local, delay=13, delays=13/0/0/0.07, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME)
Jul 25 22:22:07 localhost postfix/qmgr[31479]: DC661BEE94: removed

Wed, 07/25/2007 - 14:34 (Reply to #3)
gregc@netoverdr...

/etc/usermin/forward/autoreply.pl doesn't exist...

I copied it over from /usr/share/usermin/forward but still not working.

Sun, 06/07/2009 - 07:14 (Reply to #4)
gregc@netoverdr...

-----------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.

Thu, 07/26/2007 - 00:35 (Reply to #5)
gregc@netoverdr...

Also /etc/webmin/virtual-server/lookup-domain.pl doesn't exist. If i also copy this from /usr/share

/var/log/procmail.log

Undefined subroutine &main::get_user_domain called at /etc/webmin/virtual-server/lookup-domain.pl line 98.
procmail: Program failure (2) of "/etc/webmin/virtual-server/lookup-domain.pl"
From gregc@netovedrive.com.au Thu Jul 26 08:23:51 2007
Folder: /home/freshtel/homes/fred/Maildir/new/1185402231.18035_0.man 514
Time:1185402231 From:gregc@netovedrive.com.au To: User:fred.freshtel Size:571 Dest:/home/freshtel/homes/fred/Maildir/new/1185402231.18035_0.managed.netoverdrive.com.au Mode:None

Thu, 07/26/2007 - 01:47 (Reply to #6)
gregc@netoverdr...

Fixed.

"Ok, I see the problem now - at the end of /etc/procmailrc are the lines :

:0
$DEFAULT

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."

this worked... thanks for your help.

I just have a general question on what is and isn't installed. ie procmailrc refers to a script called /etc/webmin/virtual-server/lookup-domain.pl which doesn't exist.

if i copy this from /usr/share i get an error.
Undefined subroutine &main::get_user_domain called at /etc/webmin/virtual-server/lookup-domain.pl line 98.
procmail: Program failure (2) of "/etc/webmin/virtual-server/lookup-domain.pl"

anything to worry about?

Thu, 07/26/2007 - 03:46 (Reply to #7)
gregc@netoverdr...

OK i've done that and I'm not getting errors. thanks

In virtualmin 'Module config' i have 'per server spamassassin mail filtering' enabled.
In the test virtual server 'enabled features' the 'spam filtering enabled' is checked.

Does this mean it should have been setup right but not or is there another configuration step i missed?

Please let me know if I should move this post back to virtualmin newbie forum.

Thu, 07/26/2007 - 05:15 (Reply to #8)
Joe
Joe's picture

Yes, it should have been created when you enabled spam filtering for the first time. Did you perhaps move domains to a different system, or delete files in /etc/webmin/virtual-server ?

--

Check out the forum guidelines!

Sun, 06/07/2009 - 07:14 (Reply to #9)
CaptainR

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

Fri, 07/27/2007 - 18:18 (Reply to #10)
CaptainR

Jamie,

Thanks for your quick response.

<div class='quote'>The autoresponder in Usermin does have a feature to limit the rate of replies to the same sender - it is the 'Minimum interval between replies' field. Also, you can use variables in the response message, like $FROM, $TO, $SUBJECT and $BODY.</div>

I wasn't aware of this. Do you know if the usermin autoresponder has any smarts that prevent it from autoreplying to mailing lists, etc.?

<div class='quote'>I'm not sure why Sendmail wouldn't do .forward processing for users with user@domain format names though .. but these have always been a little tricky to support, as Sendmail confuses them with email addresses.</div>

Right. That seems to be precisely what's happening. It's like sendmail hits the &quot;@&quot; in the address and immediately stops processing .forward files. I had hoped there was a directive I could add to the sendmail.cf file to change this behaviour, and while there might be, I haven't been able to track this down; this is perhaps more difficult to find because google and similar don't allow searching for the &quot;@&quot; character.

<div class='quote'>If you want Sendmail to allow any shell, the solution is to add the line :

/SENDMAIL/ANY/SHELL/

to the /etc/shells file.
</div>

Jamie, you continue to be a font of knowledge. I haven't found that bit of information anywhere either. Thanks. Now if we can just get Sendmail to process the .forward files when the account has a '@' in it, we'd make some people happy. :-)

Cheers,
Chris

Fri, 07/27/2007 - 18:28 (Reply to #11)
Joe
Joe's picture

<div class='quote'>I wasn't aware of this. Do you know if the usermin autoresponder has any smarts that prevent it from autoreplying to mailing lists, etc.?</div>

It can detect replies to bounces, but not to lists .. unless you know of some email header that can identify a message from a list reliably? Perhaps List-Id: ?

<div class='quote'>Right. That seems to be precisely what's happening. It's like sendmail hits the &quot;@&quot; in the address and immediately stops processing .forward files. I had hoped there was a directive I could add to the sendmail.cf file to change this behaviour, and while there might be, I haven't been able to track this down; this is perhaps more difficult to find because google and similar don't allow searching for the &quot;@&quot; character.</div>

Yeah, it's issues like this that lead to me recommending againsts the use of @ in mailbox usernames..

--

Check out the forum guidelines!

Fri, 07/27/2007 - 21:37 (Reply to #12)
Joe
Joe's picture

<div class='quote'>Yeah, it's issues like this that lead to me recommending againsts the use of @ in mailbox usernames..</div>

We've even got a FAQ about it, though it's mostly specific to Postfix. The problem is a general one, but Postfix chooses to confront it head-on while Sendmail ignores it until you run into weird stuff like this. ;-)

--

Check out the forum guidelines!

Mon, 07/30/2007 - 23:13 (Reply to #13)
JelckedeBoer

I have similar problems with e-mail not working.
This is part of my procmail log with the problem:

From root@vm200.webfauna.nl Mon Jul 30 21:49:18 2007
Subject: test
Folder: /dev/null 471
/bin/sh: /etc/webmin/virtual-server/procmail-logger.pl: Permission denied
/bin/sh: /etc/webmin/virtual-server/clam-wrapper.pl: Permission denied
procmail: Error while writing to &quot;/etc/webmin/virtual-server/clam-wrapper.pl&quot;
procmail: Program failure (126) of &quot;/etc/webmin/virtual-server/clam-wrapper.pl&quot;

But wat is the <b>fix</b>?

Mon, 07/30/2007 - 23:42 (Reply to #14)
Joe
Joe's picture

It sounds like the permissions on those files or perhaps directories are incorrect on your system, which is odd as Virtualmin sets them correctly when installing or upgrading.

The fix is to run :

chmod 755 /etc/webmin/virtual-server/*.pl
chmod 755 /etc/webmin/virtual-server
chmod 755 /etc/webmin

--

Check out the forum guidelines!

Wed, 05/28/2008 - 14:22 (Reply to #15)
markoshust

<b>JaimeCameron wrote:</b>
<div class='quote'>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.</div>

Jaime, I am unable to find 'Spam filtering options' or the 'Allow mailbox users to configure procmail' section under Virtualmin &gt; 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!

Wed, 05/28/2008 - 19:25 (Reply to #16)
Joe
Joe's picture

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

--

Check out the forum guidelines!

Sat, 07/21/2007 - 20:48
CaptainR

Do you have your user accounts in the format of &quot;user@domain.tld&quot;?

Tue, 07/24/2007 - 23:59
gregc@netoverdr...

Hi,

I wanted to use the username@domain.tld format but I also tried the domain-username format and it didn't work either.

maybe because i initially set it up to use the '@' whatever's broken remains broken.

I had wanted some feedback on this before I reinstall virtualmin (again) to find out.

What syntax are you using?

Greg

Wed, 07/25/2007 - 00:02 (Reply to #19)
Joe
Joe's picture

Hey Greg,

Don't reinstall Virtualmin! This is minor, and probably a bug (which would also exist after a reinstall).

I'll ask Jamie to drop in on this thread. I'm guessing we'll need to have a look at the procmail configuration and logs to know what's happening. It should work whether you have @ in the username or not (though there have been bugs in the past with forwarding and @ in usernames...but those have long since been fixed...so this one is something new).

--

Check out the forum guidelines!

Wed, 07/25/2007 - 00:20
Joe
Joe's picture

Hi Greg,
Have you tried using the Filter Mail module in Usermin instead? It has taken the place of the Mail Forwarding module, which is actually disabled by default in recent Virtualmin releases.

The biggest difference between them is that Filter Mail configures the user's .procmailrc file, while Mail Forwarding sets up .forward. However, some mail servers do not even check .forward at all, so anything setup there may be ignored.

--

Check out the forum guidelines!

Wed, 07/25/2007 - 18:32
Joe
Joe's picture

Could you post the contents of the /etc/procmailrc and ~fred-freshtel.com/.procmailrc files to this bug report?

--

Check out the forum guidelines!

Thu, 07/26/2007 - 01:24
Joe
Joe's picture

Ok, I see the problem now - at the end of /etc/procmailrc are the lines :

:0
$DEFAULT

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.

Some admins may prefer that this be set to 'No', in order to prevent mailbox users from running commands via their .procmailrc files. Unfortunately, this will prevent user-configurable mail filtering from working.

In the next Usermin release, I will add a warning message in the Filter Mail module to detect this situation.

--

Check out the forum guidelines!

Sun, 06/07/2009 - 07:14
Joe
Joe's picture

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, &quot;/etc/webmin/miniserv.conf&quot;);
while(&lt;CONF&gt;) {
$root = $1 if (/^root=(.*)/);
}
close(CONF);
$ENV{'WEBMIN_CONFIG'} = &quot;/etc/webmin&quot;;
$ENV{'WEBMIN_VAR'} = &quot;/var/webmin&quot;;
chdir(&quot;$root/virtual-server&quot;);
exec(&quot;$root/virtual-server/lookup-domain.pl&quot;, @ARGV);

and then run :

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

--

Check out the forum guidelines!

Fri, 07/27/2007 - 18:05
Joe
Joe's picture

Hi Chris,

The autoresponder in Usermin does have a feature to limit the rate of replies to the same sender - it is the 'Minimum interval between replies' field. Also, you can use variables in the response message, like $FROM, $TO, $SUBJECT and $BODY.

I'm not sure why Sendmail wouldn't do .forward processing for users with user@domain format names though .. but these have always been a little tricky to support, as Sendmail confuses them with email addresses.

If you want Sendmail to allow any shell, the solution is to add the line :

/SENDMAIL/ANY/SHELL/

to the /etc/shells file.

--

Check out the forum guidelines!

Mon, 08/18/2008 - 17:51
CyborgPrime

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 &lt;username&gt;.&lt;userdomain&gt;@&lt;myservername&gt;.com instead of &lt;username&gt;@&lt;userdomain&gt;.com

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

Topic locked