On 2009-09-17 Arora, Sumit wrote: > Here are my requirements: > - I have to setup my own SMTP server to receive emails (I chose > postfix, sm body referred me) > - Then I have to pass the email body and attachments to a component to > process it. > - My postfix server should be able to receive all emails sent to my > domain name e.g. anyth...@mydomain.com > - It is preferred that there should not be any time gap between I > receive email and process them, so probably I cannot have any other > small smtp server to fetch emails from my postfix server.
Sounds like a job for procmail, IMO. Install procmail and add the following line to your main.cf: mailbox_command = procmail -a "$EXTENSION" Create a file .procmailrc with the following content in your $HOME (assuming your mailbox format is mbox): ----8<---- MAILDIR=$HOME/Mail # Make sure the directory exists! DEFAULT=$MAILDIR/inbox LOCKFILE=$HOME/.lockmail # Remove the following two lines when everything is working as expected, # lest the log will grow VERY BIG VERY FAST. LOGFILE=$HOME/procmail.log VERBOSE=on :0 fhw | formail -I "" -s YOUR_PROGRAM ---->8---- This will deliver all your incoming mail to your local mailbox while feeding the mailbodies to your program. > - By security perspective, my postfix server should be able to do > anti-spoofing and stop junk emails. http://jimsun.linxnet.com/misc/postfix-anti-UCE.txt > Here is the output of "postconf -n" [...] > inet_interfaces = 16.150.18.223, $myhostname, localhost inet_interfaces = 16.150.18.223, 127.0.0.1 Regards Ansgar Wiechers -- "Abstractions save us time working, but they don't save us time learning." --Joel Spolsky