I just thought I could explain a little more. Because that link has way to much details
..this story got a little long, but I think it's useful too
postfix + imap
- first try to install postfix (and uninstall sendmail). You should be able to send e-mail through postfix to another host.
Try to use 127.0.0.1 as your SMTP server, and try to send a normal e-mail.
- Postfix also requires you to use an aliases file. it's created by the program "newaliases". I've configured postfix to send all root@localhost mail to my own user@localhost for example
- Then you should configure the local delivery: configure postfix to use maildrop as local mail delivery agent. In other words, when you send an e-mail to you@localhost, it will be passed to maildrop. maildrop will use the ~/.mailfilter to filter the file, and store the e-mail in ~/Maildir/...
- Get courier imap working; instead of reading the e-mail directly from ~/Maildir/, you can connect to your system on the imap port. Most e-mail programs, also outlook express support imap.
There are 2 ways you could receive your e-mail:
- make the postfix server accessible from the internet, and people could send e-mail to yourusername@yourmachine. You need to be careful with this; If your system is an open-relay, spammers could use your mailserver to send messages. And every service accessible from the internet is a possible way to break into your system.
- To retreive pop3 mail you could use "fetchmail". fetchmail downloads pop3 mail, and forwards it to postfix automatically.
- I run fetchmail every hour from a cron-job. If my msn messenger receives a new-mail notification, fetchmail is enabled as well
Sending e-mail can be done very easy; you don't need to SMTP of your ISP anymore, you can just use localhost
you can use any IMAP capable mail client. You could use outlook express from another Windows workstation, or KMail, Mozilla-mail, mutt, or Squirllmail (webmail). It doesn't matter which client you use, the e-mail will look exactly the same!
(even the read-status, etc..
message filtering examples
From the ~/.mailfilter file, I sort all messages. Maildrop rules apply to the message text.
- This part of my ~/.mailfilter passes the message to spamassassin, and detects the changes that spamassassin makes to spam e-mails.
xfilter "/usr/bin/spamassassin -x"
if( /^X-Spam-Flag: YES/ )
log "---- *SPAM* detected. "
- To filter virus e-mail, that causes outlook express to invoke attachments automatically if you only view a message!:
if( $SIZE < 200000 )
# Match the <iframe> exploit of outlook express, that causes execution
# of programs, loaded my the iframe, because on an mangled content type.
if( /<iframe src=3D"?cid:/:b )
log "---- *VIRUS* outlook <iframe> exploit"
# Remove attachments with unwanted file extensions
# It seams another nasty trick is also popular:
# A lot of spaces between the .ext and .pif extension.
# Content-Type: audio/x-midi
# <tab> name=file.ext .pif
if( /[\n\r]Content\-Type: [a-zA-Z\-\/]+;[\n\r]*[:space:]+name=.*\.(bat|pif|scr)"?[\n\r]/:bw )
log "---- *VIRUS* unwanted extensions in content-type"
# Content-Disposition: attachment; filename=file.src
if( /[\n\r]Content\-Disposition: attachment;[\n\r]*[:space:]+filename=.*\.(bat|pif|scr|exe)"?[\n\r]/:bw )
log "---- *VIRUS* unwanted extensions in content-disposition"
- Finally, this part of the code sorts a message to another folder:
# messages from my site to another imap folder:
if( /^Received: from mail\.codingdomain\.com/ )
if( /(To|Cc|Bcc): .*webmaster@codingdomain\.com/ )