====== Installing Python Milter ======
===== Intro =====
Since I ran into a couple of minor hangups with this, I figured I would pass along a little info to help out anyone who also ran into snags getting this working. I have to say, the [[http://www.bmsi.com/python/milter.html|Python Milter]] module put together by Jim Niemira and Stuart D. Gathman is really quite good once you get it up and running.
**Note:** This is geared towards people out there who are **not** running [[wp>Sendmail]]. Personally, I would rather run my hands through a wood chipper than use [[wp>Sendmail]], so this is for those of you running [[wp>Postfix]], like I do.
===== Install libmilter =====
This was a straightforward process on my [[http://gentoo.org|Gentoo]] machine. There is a ''libmilter'' package in Portage, albeit masked, so it was just a matter of:
# ACCEPT_KEYWORDS="~x86" emerge libmilter
That was easy.
===== Installing Python Milter =====
First, download a copy of Python Milter from sourceforge: http://sourceforge.net/project/showfiles.php?group_id=139894&package_id=243476&release_id=688263
I downloaded the source, and that's what I'm going to be dealing with here. Once you have it downloaded, untar it and move into that directory:
# tar -xvzf pymilter-.tar.gz
# cd pymilter-
Now, here is where I ran into problems. When I ran the installer, I got the following error:
# python setup.py install
running install
running build
running build_py
running build_ext
building 'milter' extension
i686-pc-linux-gnu-gcc -pthread -shared build/temp.linux-i686-2.4/miltermodule.o -lmilter -lsmutil -o build/lib.linux-i686-2.4/milter.so
/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lsmutil
collect2: ld returned 1 exit status
error: command 'i686-pc-linux-gnu-gcc' failed with exit status 1
Taking a look at it reveals that ''gcc'' can't find the ''smutil'' library. I took a guess and figured that ''smutil'' was probably "Sendmail Utilities". [[installpymilter#The Fix|The fix is next]].
===== The Fix =====
The fix for me was quite simple. I just downloaded the source for Sendmail itself matching the version of ''libmilter'' that I had installed (in this case, it was 8.14.3). Once I had it downloaded, I just built it and added ''libsmutil.a'' to to my lib directory, ''/usr/lib''.
# tar -xvzf sendmail.8.14.3.tar.gz
# cd sendmail-8.14.3
# ./Build
# cp obj.Linux.2.6.19-gentoo-r5.i686/libsmutil/libsmutil.a /usr/lib
After that, I reran the install for Python Milter and it installed and worked without a hitch.
Hope this helps someone else out there because the Python Milter library works really well.