Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 12-31-2005, 10:41 PM   #1
Registered: Aug 2002
Location: Copperas Cove, Texas
Distribution: Ubuntu 16.04 LTS
Posts: 203

Rep: Reputation: 15
Procmail/Formail recipe question

I've got a fromail recipe embeded in my .procmailrc that I use to determine the following information:


This works fine for my main isp, Earthlink. but, I want it to also work for my own domain, and for mail I pickup from yahoo using fetchyahoo. All mail is being filtered through procmail, I just can't get the above information added to toadnet and yahoo at the end of the headers. Below is the recipe:

# Add X-ASN header
# KMSelf Sun Jul 11 04:05:32 PDT 2004
# Add headers for ASN and originating IP.
# Original author: Karsten M. Self
# Requires FORMAIL variable be set (most procmail recipe sets do this).
# You *must* set your SMTP_SERVER identifier.
# Run this *BEFORE* any spamassassin processing. The header tag itself
# should start being scored as a Bayesian attributed.

# FORMAIL = /usr/bin/formail

SMTP_SERVER = (EarthLink SMTP Server|by toadnet\.com (\8\.12\.11/8\.12\.11\)|by mta[0-9]*\.mail\..*\.yahoo\.com)

# ----------------------------------------------------------------------
# Parse out the sender's IP address.
SENDERIP = `formail -c -XReceived | grep "$SMTP_SERVER" | \
tr '[][\t <>()]' '\n' | \
grep '^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$' | \
tail -1`

# Reverse IP for reverse DNS query
sed "s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\4.\3.\2.\1/"`

# Query for the ASN.
# Note that this is pretty aggressive: wait six seconds, retry ten
# times, may slow mail processing, but tends to improve data quality.
# Run a caching DNS server for improved performance.
# Raw is a mostly unmunged output (save quotes and prefix). Contains
# ASN, IP, and CIDR prefix.
RAW_ASN = `host -W 6 -R 10 -t txt $ | \
sed -e 's/.* text //' -e 's/"//g'`
ASN = `echo $RAW_ASN | cut -d ' ' -f 1`
ASN_CIDR = `echo $RAW_ASN | cut -d ' ' -f 2`/`echo $RAW_ASN | cut -d ' ' -f 3`



# ------------------------------------------------------------------------
# Add X-SenderIP header.
:0 fhw
* ! ^X-SenderIP:
# ------------------------------------------------------------------------

# ------------------------------------------------------------------------
# Add X-ASN header.
:0 fhw
* ! ^X-ASN:
# ------------------------------------------------------------------------

# ------------------------------------------------------------------------
# Add X-CIDR header.
:0 fhw
* ! ^X-CIDR:
# ------------------------------------------------------------------------

It originally started off as the smtp_server line being only earthlinks, the others have been added since. The output is supposed to look like:

X-ASN: ASN-8075

Which it does for mail from earthlink, however, from toadnet and yahoo it looks like this:


I'm pretty sure the problem is in this line:

SMTP_SERVER = (EarthLink SMTP Server|by toadnet\.com (\8\.12\.11/8\.12\.11\)|by mta[0-9]*\.mail\..*\.yahoo\.com)

However, I can't seem to find it. Any assistance would be appreciated



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
formail fails on virtual user [qmail,vpopmail,procmail,formail] jonavogt Linux - Networking 2 01-15-2009 09:29 AM
formail with procmail priyesh Programming 2 10-22-2003 11:01 PM
Procmail and formail aBl_tR3kr Linux - Software 1 03-26-2003 10:15 AM
procmail and formail aBl_tR3kr Linux - Networking 1 03-26-2003 10:02 AM
procmail and formail aBl_tR3kr Linux - Newbie 0 03-26-2003 09:41 AM

All times are GMT -5. The time now is 03:38 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration