HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=27)
-   -   autoreply, mail filter, custom rules, send copy can't work (http://www.howtoforge.com/forums/showthread.php?t=53233)

labanczjoe 27th June 2011 10:05

autoreply, mail filter, custom rules, send copy can't work
 
Hello!


Sorry for my english. I have installed an Ispconfig 3 server. Ubuntu 10.4 - perfect server installer.
Everything works fine - all main (send/receive) mail functions. Courier imap + maildrop.

But if i create a mail filter (CC) , autoresponder, send copy the /var/mail/mailfilters/mydomain.hu/username/.mailfilter ... ,autoresponder files are created but cannot work.

Please help me!

Thanks

falko 28th June 2011 09:40

Are there any errors in your mail log (in the /var/log/ directory)?

labanczjoe 28th June 2011 09:54

Thanks Your fast reply!

There are no errors. There are cc rule, send copy to the teszt user but nothing happens if I send an email to the test user.

Jun 28 09:42:34 ledobjuk postfix/qmgr[6088]: C49CE58C31AE: from=<joe@mydomain.hu>, size=1094, nrcpt=1 (queue active)
Jun 28 09:42:34 ledobjuk amavis[22298]: (22298-16) Passed CLEAN, [my.domain.ip.addr] [my.domain.ip.addr] <joe@mydomain.hu> -> <teszt@mydomain.hu>, Message-ID: <4E0985EA.9020300@mydomain.hu>, mail_id: O-6CN7c7NYRP, Hits: -2.899, size: 614, queued_as: C49CE58C31AE, 179 ms
Jun 28 09:42:34 ledobjuk postfix/smtp[21288]: 99B1758C31A7: to=<teszt@mydomain.hu>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.2, delays=0.01/0/0/0.18, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=22298-16, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as C49CE58C31AE)
Jun 28 09:42:34 ledobjuk postfix/qmgr[6088]: 99B1758C31A7: removed
Jun 28 09:42:34 ledobjuk postfix/pipe[23227]: C49CE58C31AE: to=<teszt@mydomain.hu>, relay=maildrop, delay=0.02, delays=0/0/0/0.01, dsn=2.0.0, status=sent (delivered via maildrop service)
Jun 28 09:42:34 ledobjuk postfix/qmgr[6088]: C49CE58C31AE: removed


Joe

labanczjoe 30th June 2011 11:03

Maybe a postfix problem? Maybe user rights? Any idea?

till 30th June 2011 14:06

Please post the content of the postfix master.cf file and the content of the /var/vmail/.mailfilter file.

labanczjoe 30th June 2011 14:19

Hello Till!

master.cf:
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ================================================== ========================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ================================================== ========================
smtp inet n - - - - smtpd
#submission inet n - - - - smtpd
# -o smtpd_tls_security_level=encrypt
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticate d,reject
# -o milter_macro_daemon_name=ORIGINATING
#smtps inet n - - - - smtpd
# -o smtpd_tls_wrappermode=yes
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticate d,reject
# -o milter_macro_daemon_name=ORIGINATING
#628 inet n - - - - qmqpd
pickup fifo n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - - 300 1 oqmgr
tlsmgr unix - - - 1000? 1 tlsmgr
rewrite unix - - - - - trivial-rewrite
bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - - - - smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay unix - - - - - smtp
-o smtp_fallback_relay=
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - - - - showq
error unix - - - - - error
retry unix - - - - - error
discard unix - - - - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - - - - lmtp
anvil unix - - - - 1 anvil
scache unix - - - - 1 scache
#
# ================================================== ==================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ================================================== ==================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d vmail ${extension} ${recipient} ${user} ${nexthop} ${sender}
#
# ================================================== ==================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
# mailbox_transport = lmtp:inet:localhost
# virtual_transport = lmtp:inet:localhost
#
# ================================================== ==================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - pipe
# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ================================================== ==================
# Old example of delivery via Cyrus.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ================================================== ==================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}


amavis unix - - - - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes

127.0.0.1:10025 inet n - - - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,rej ect
-o mynetworks=127.0.0.0/8
-o strict_rfc821_envelopes=yes
-o receive_override_options=no_unknown_recipient_chec ks,no_header_body_checks
-o smtpd_bind_address=127.0.0.1


mailfilter:

#
# Import variables
#
LOGNAME=tolower("$LOGNAME")
EXTENSION="$1"
RECIPIENT=tolower("$2")
USER=tolower("$3")
HOST=tolower("$4")
SENDER="$5"
DEFAULT="/var/vmail/$HOST/$USER/."

# Workaround for broken tolower function in some current fedora releases

if(!$USER)
{
USER=$3
}
if(!$HOST)
{
HOST=$4
}

if ( "$EXTENSION" ne "" )
{
DELIMITER="+"
}

if (!$SENDER)
{
SENDER = "<>"
}

#
# Autocreate maildir, if not existant
#

`test -e /var/vmail/$HOST`
if ( $RETURNCODE != 0 )
{
`mkdir /var/vmail/$HOST`
}

`test -e /var/vmail/$HOST/$USER`
if ( $RETURNCODE != 0 )
{
# `maildirmake /var/vmail/$HOST/$USER`
# `chmod -R 0700 /var/vmail/$HOST`
}


Thanks for your help!

labanczjoe 5th July 2011 13:21

Hello Till!

Do you see any error? The holiday season started and i would like to use the autoresponder (or cc/send copy).

I read many forum/site but cannot find the solution... :(

Thanks

Joe

labanczjoe 27th July 2011 12:25

Hello!


Any idea?


Joe

till 27th July 2011 12:31

The mailfilter file is incomplete or you did not post the whole file. The complete mailfilter file should look like this:

Code:

#
# Import variables
#

LOGNAME=tolower("$LOGNAME")
EXTENSION="$1"
RECIPIENT=tolower("$2")
USER=tolower("$3")
HOST=tolower("$4")
SENDER="$5"
DEFAULT="/var/vmail/$HOST/$USER/."

# Workaround for broken tolower function in some current fedora releases

if(!$USER)
{
  USER=$3
}
if(!$HOST)
{
  HOST=$4
}

if ( "$EXTENSION" ne "" )
{
  DELIMITER="+"
}

if (!$SENDER)
{
  SENDER = "<>"
}

#
# Autocreate maildir, if not existant
#

`test -e /var/vmail/$HOST`
if ( $RETURNCODE != 0 )
{
  `mkdir /var/vmail/$HOST`
}

`test -e /var/vmail/$HOST/$USER`
if ( $RETURNCODE != 0 )
{
  `maildirmake /var/vmail/$HOST/$USER`
  `chmod -R 0700 /var/vmail/$HOST`
}

# Check if the user has a autoresponder enabled

`test -f /var/vmail/mailfilters/$HOST/$USER/.autoresponder`
if ( $RETURNCODE == 0 )
{
  include "/var/vmail/mailfilters/$HOST/$USER/.autoresponder"
}

# Create a mailsize file
`echo $SIZE >> /var/vmail/$HOST/$USER/ispconfig_mailsize`


#
# Test if the user has his own maildrop include,
# if not available, check if $DEFAULT is set
# (newer maildrop get's that from the DB and updates
# it) and deliver or fail temporarily if not available
#

`test -f /var/vmail/mailfilters/$HOST/$USER/.mailfilter`
if ( $RETURNCODE == 0 )
{
  include "/var/vmail/mailfilters/$HOST/$USER/.mailfilter"
}
else
{
  if ( "$DEFAULT" ne "" )
  {
    to "$DEFAULT"
  }
  else
  {
    EXITCODE=75
    exit
  }
}


labanczjoe 27th July 2011 12:50

Hello!

Sorry , here is my full .mailfilter file : copy/paste user error :(

#
# Import variables
#
logfile "/temp/maildrop3.log"
LOGNAME=tolower("$LOGNAME")
EXTENSION="$1"
RECIPIENT=tolower("$2")
USER=tolower("$3")
HOST=tolower("$4")
SENDER="$5"
DEFAULT="/var/vmail/$HOST/$USER/."
#logfile "/var/mail/$HOST/$USER/mailfilter.log"

# Workaround for broken tolower function in some current fedora releases

if(!$USER)
{
USER=$3
}
if(!$HOST)
{
HOST=$4
}

if ( "$EXTENSION" ne "" )
{
DELIMITER="+"
}

if (!$SENDER)
{
SENDER = "<>"
}

#
# Autocreate maildir, if not existant
#

`test -e /var/vmail/$HOST`
if ( $RETURNCODE != 0 )
{
`mkdir /var/vmail/$HOST`
}

`test -e /var/vmail/$HOST/$USER`
if ( $RETURNCODE != 0 )
{
# `maildirmake /var/vmail/$HOST/$USER`
# `chmod -R 0700 /var/vmail/$HOST`
}


`test -e /var/vmail/$HOST/$USER`
if ( $RETURNCODE != 0 )
{
# available exitcodes: EX_NOUSER=67, EX_TEMPFAIL=75
EXITCODE = 67
exit
}
# Check if the user has a autoresponder enabled

`test -f /var/vmail/mailfilters/$HOST/$USER/.autoresponder`
if ( $RETURNCODE == 0 )
{
include "/var/vmail/mailfilters/$HOST/$USER/.autoresponder"
}

# Create a mailsize file
`echo $SIZE >> /var/vmail/$HOST/$USER/ispconfig_mailsize`


#
# Test if the user has his own maildrop include,
# if not available, check if $DEFAULT is set
# (newer maildrop get's that from the DB and updates
# it) and deliver or fail temporarily if not available
#

`test -f /var/vmail/mailfilters/$HOST/$USER/.mailfilter`
if ( $RETURNCODE == 0 )
{
include "/var/vmail/mailfilters/$HOST/$USER/.mailfilter"
}
else
{
if ( "$DEFAULT" ne "" )
{
to "$DEFAULT"
}
else
{
EXITCODE=75
exit
}
}


All times are GMT +2. The time now is 08:54.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.