Stephen Reese

Setting up maildrop with Courier MTA

Before I get into the maildrop here are a few notes to myself for setting up Courier.

Before running ./configure you should add ssl bin directory to your path
To receive local mail indifferent of caps touch {your/etc/courier/dir}locallowercase

Account postmaster@ HAS to be set up as well in the /usr/lib/courier/etc/aliases/system file

To tell courier about hosted domains,

add domain to, /etc/courier/hosteddomains

then,as root, run makehosteddomains

and to tell courier to accept esmtp connections for the domain

add domains to /etc/courier/esmtpacceptmailfor.dir/domains

then,as root, run makeacceptmailfor

Also, the email account postmaster@ HAS to be set up as well.

Here is the maildrop stuff:

  1. Edit the “/usr/lib/courier/etc/maildroprc” to have “| /usr/lib/courier/bin/maildrop” as your delivery method

  2. Create a “$HOME/.mailfilter” file to be read by maildrop, there is no need for the most part of a “.courier” since mail drop is already being used!

  3. Make sure your “/usr/lib/courier/etc/maildroprc” doesn’t kill the install IE:

#attempt at a maildroprc file...  
if ( $SIZE < 26144 )  
{  
exception {  
xfilter "/usr/bin/spamassassin"  
}  
}  
if (/\^X-Spam-Flag: \*YES/)  
{  
exception {  
to "$HOME/Maildir/.Trash/"  
}  
}  
\#else  
\#{  
\# exception {  
\# to "$HOME/Maildir/"  
\# }  
\#}

The commented out part is no good since your “.mailfilter” will never be read so DON’T specifiy the default delivery since no matter what unless specified other wise by an exit command will courier deliver to the default “$HOME/Maildir” also goes for the .mailfilter, no matter where u send the mail to there is no need to send it to the default location unless you have some crazy kaos going on that is beyond my lame howto =)

\4. The contents of your “.mailfilter should be something like the following:

| /usr/lib/courier/bin/mailbot -t autoresponse -s ‘AutoGoAwayMessage’ -A ‘From: test@prcdigital.com’ /usr/sbin/sendmail -f “

A “autoresponse” file should be created and placed in the same $HOME directory as the “.mailfilter” is located, though a universal file can be created from multiple users to access if desired.

\5. “chmod 600 .mailfilter autoresponse”

Also the same user:group that is owner of the Maildir should also own these two files so “chown user:group .mailfilter autoresponse”

or Once you get to maildrop, you don’t want to bounce it. Your best bet is to just drop it. Also, I would suggest using spamc/spamd if at all possible. This is what I would do:

  if ( $SIZE < 204800 )  {      exception {          xfilter "/usr/bin/spamc"      }  }

  if ((/^X-Spam-Flag: YES/))  {      if ((/^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/))      {          echo "***** Dropping 15+ Spam *****"          EXITCODE = 0          exit      }      else      {          to "$HOME/Maildir/.Trash/"      }  }  to "$HOME/Maildir/"

You can get rid of the echo if you don’t want an entry in the log when it drops an email.

if ((/^X-Spam-Flag: YES/))

Why double parentheses? This is what I am using and it is not working, though it seemed to work until recently:

if (/^X-Spam-Level: *\*\*\*\*\*\*\*/){      exception {              to "/dev/null"      }}

Comments

comments powered by Disqus