LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] {LONG} sendmail smart host & procmail recipies

[ILUG] {LONG} sendmail smart host & procmail recipies

Declan Grady Declan.Grady at nuvotem.com
Tue May 14 10:08:46 IST 2002


Hi again folks,
Apologies if this was covered recently.. I thought the list had died until I
realised in my shiny new sendmail config, I had forgotten an alias for
myself !!

Currently I have defined a "smart host" in my sendmail.mc file as:

define(`SMART_HOST',`smtp:mail.iol.ie')dnl

I would like to use this smart host, but only after attempting a direct
delivery.
i.e. I'd like my sendmail to try to deliver to the destination domain, and
if that fails, then send it to the smart host ?

Any suggestions ?

Another question.. I am still trying to use procmail (my lda) to reject
messages over a specified size limit, but I dont want to have to define this
for each luser. Can I define a system-wide .procmailrc to reject these
mails, but also have individual .procmailrc's for specific users, which
would override this ?

I have a working .procmailrc in my '/home/testmaxsize' folder, and it will
reject the messgaes over 350K in size:

(All credit to http://ronny.haryan.to/procmailrc )

#############################################################
SHELL=/bin/bash
VERBOSE=no
LOGABSTRACT=all
LOGFILE=$HOME/.log-procmail
MAILDIR=/var/spool/
SENDMAIL=/usr/sbin/sendmail
OVERSIZEMSG="/home/over_size_message_text"
ENVELOPE=`formail -x "From "`
FROMHV=`formail -zx "From: "`
TOHV=`formail -zx "To: "`

# maximum message size (including headers, i think) in bytes
MAX_SIZE=350000

:0fhw
* > $MAX_SIZE
| formail -A "X-Reject: Message size is over limit"

###########################################################################
# actions
###########################################################################

# autoresponder for oversized messages
# comment out the whole thing if you don't want it

LIST_MAILERS='((Mail(er)?-?)?daemon|root|LISTSERV|ListProc|\
[a-zA-Z0-9-]+-(list|request|owner)|(owner-)?list-[a-zA-Z0-9-]+|\
Majordomo|Mailagent|Postmaster|mmdf|news|n?uucp)|efax|egroups\.com'

SENDER=`formail -rtzx To:`

PRE_ADDR_SPAN='(.*[^-(.%@a-zA-Z0-9])?'
POST_ADDR_SPAN='(([^),.!:a-zA-Z0-9].*)?(,|$[^>]))'
FROMHDR="(^(((Resent-)?(From|Sender)|X-Envelope-From):|>?From )$PRE_ADDR_SPA
N)"

# don't respond to UCE tagged messages, or ones sent by known
# listmailers, including efax
:0h
* > $MAX_SIZE
*  !^FROM_DAEMON
* $! SENDER ?? $LIST_MAILERS
* $!^X-Loop: *$MY_ADDR
* $!^X-Reject: \[UCE\]
* $!^Delivered-To: mailing list
* $!^X-Mailing-List:
{
    DELIVERED=yes
        COMSAT=off
        LOGFILE=$HOME/.log-procmail
        HDR=`formail -r -I"Subject:" -I"References" -I"In-Reply-To"`
        DATE=`date`
        LOG="$DATE sent autoreply (re: size) $HDR
"
        LOGFILE

    :0fw
    | ( formail -rI"From: <postmaster at nuvotem.com>" \
        -I"Precedence: junk" \
        -I"X-Loop: postmaster at nuvotem.com" \
        -I"X-Mailer: procmailrc recipe" \
        -I"References:" ; \
    cat $OVERSIZEMSG ; ) | $SENDMAIL -t
}





















More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell