how to configure linux+postfix to pickup ISP email IMAP style
how to configure linux+postfix to pickup ISP email IMAP style
am 31.12.2006 14:14:28 von Andrew Marlow
I am in the process of changing email provider and would like to setup my
linux+postfix machine to pick up the email automatically and apply my own
filter environment to it (probably based on spamassassin). I would then
like to read this email via a normal email client such as thunderbird. I
don't know where to start. Can anyone give me any pointers please?
I have set up a number of email accounts with the ISP. To pick up this
email I have to connect to their IMAP service supplying usernames and
passwords I have set up. In the past this was easily done with thunderbird
but now I want my postfix setup to do this automatically and route it to
virtual email boxes hosted on my linux machine. Then I intend to use
thunderbird to pick up the emails from the linux machines virtual email
boxes.
I have been searching on the web for days but with no luck. The closest I
came was Eric Raymonds fetchmail program but that seems to have gone into
early maintainance mode and various web sites are slagging it off for
having several technical problems. I used to use it ages ago and found it
ok though a little clunky. I prefer to use something that is in more
active development. But what? How are these things normally done?
-Andrew Marlow
Re: how to configure linux+postfix to pickup ISP email IMAP style
am 31.12.2006 18:32:42 von Andrew Marlow
On Sun, 31 Dec 2006 13:14:28 +0000, Andrew Marlow wrote:
> I am in the process of changing email provider and would like to setup my
> linux+postfix machine to pick up the email automatically and apply my own
> filter environment to it
I would like to add some information. I have looked into postfix
whitelists and this is not quite what I want (just in case anyone suggests
it). It seems good initially but if a sender is not on the whitelist the
incoming email is rejected. I want some custom behaviour here. I want to
send a special message that directs the recipient to a web page where a
proforma can be used to send email. Emails sent from this proforma will
always be rcvd since the sending user is on my whitelist.
BTW it looks like I will have to use fetchmail. So I have a basic
fetchmail+postfix setup working now, I just need to find a way to
implement the whitelist.
-Andrew M.
Re: how to configure linux+postfix to pickup ISP email IMAP style
am 31.12.2006 21:18:43 von Garen Erdoisa
Andrew Marlow wrote:
> On Sun, 31 Dec 2006 13:14:28 +0000, Andrew Marlow wrote:
>
>> I am in the process of changing email provider and would like to setup my
>> linux+postfix machine to pick up the email automatically and apply my own
>> filter environment to it
>
> I would like to add some information. I have looked into postfix
> whitelists and this is not quite what I want (just in case anyone suggests
> it). It seems good initially but if a sender is not on the whitelist the
> incoming email is rejected. I want some custom behaviour here. I want to
> send a special message that directs the recipient to a web page where a
> proforma can be used to send email. Emails sent from this proforma will
> always be rcvd since the sending user is on my whitelist.
>
> BTW it looks like I will have to use fetchmail. So I have a basic
> fetchmail+postfix setup working now, I just need to find a way to
> implement the whitelist.
IMHO
A typical setup would be:
Use a program such as fetchmail to download email from the remote
account. You can then have fetchmail handoff the email to procmail for
delivery. You can then use procmail to filter and/or call other email
filters such as bogofilter (a bayesian filter) and/or SpamAssassan,
SpamBouncer, or whatever. Have the spamfilters setup to add headers to
the email which when the filter is done with the email, you can use
those headers to sort your mail delivery with procmail into various
local folders (perhaps including /dev/null) or forward the emails on to
other accounts for delivery.
It's not a simple setup, but it is very effective at sorting good mail
from bad.
--
Garen
Re: how to configure linux+postfix to pickup ISP email IMAP style
am 31.12.2006 21:28:50 von Andrew Marlow
On Sun, 31 Dec 2006 13:18:43 -0700, Garen Erdoisa wrote:
> Andrew Marlow wrote:
> IMHO
> A typical setup would be:
>
> Use a program such as fetchmail to download email from the remote
> account.
Done.
> You can then have fetchmail handoff the email to procmail for
> delivery.
Actually, fetchmail sends it on to postfix, which in turn can be
configured to send it on to procmail.
> You can then use procmail to filter and/or call other email filters such
> as bogofilter (a bayesian filter) and/or SpamAssassan, SpamBouncer, or
> whatever.
This is what I have been trying to do but I have had bad luck all day. No
matter how I try to configure procmail the system behaves as if procmail
is not invoked or involved. I have tried it both ways; invoking procmail
from postfix (it does get invoked, the postfix logfile says so) and by
invoking procmail via my .forward file. In either case the filter program
I have set up does not get invoked. It is a little perl program that just
writes a debug line to a file, just so I know it has been invoked. The
perl script works fine standalone. It does not get invoked via the
procmail route. My .procmailrc file is:
LOGFILE=$HOME/.procmailrc.log
VERBOSE=yes
:0fw
| /home/amarlow/bin/filter_email.pl
Any ideas please? I am tearing my hair out!!!!
-Andrew
> Have the spamfilters setup to add
> headers to the email which when the
> filter is done with the email, you can use those headers to sort your
> mail delivery with procmail into various local folders (perhaps
> including /dev/null) or forward the emails on to other accounts for
> delivery.
>
> It's not a simple setup, but it is very effective at sorting good mail
> from bad.
>
Re: how to configure linux+postfix to pickup ISP email IMAP style
am 31.12.2006 22:24:03 von Garen Erdoisa
Andrew Marlow wrote:
> On Sun, 31 Dec 2006 13:18:43 -0700, Garen Erdoisa wrote:
>
>> Andrew Marlow wrote:
>> IMHO
>> A typical setup would be:
> [SNIP]
>
> This is what I have been trying to do but I have had bad luck all day. No
> matter how I try to configure procmail the system behaves as if procmail
> is not invoked or involved. I have tried it both ways; invoking procmail
> from postfix (it does get invoked, the postfix logfile says so) and by
> invoking procmail via my .forward file. In either case the filter program
> I have set up does not get invoked. It is a little perl program that just
> writes a debug line to a file, just so I know it has been invoked. The
> perl script works fine standalone. It does not get invoked via the
> procmail route. My .procmailrc file is:
>
> LOGFILE=$HOME/.procmailrc.log
> VERBOSE=yes
> :0fw
> | /home/amarlow/bin/filter_email.pl
>
> Any ideas please? I am tearing my hair out!!!!
I see. Well on my system, I just have fetchmail deliver directly to
procmail, not involving postfix or anything else.
This is an example ${HOME}/.fetchmailrc
----${HOME}/.fetchmailrc-----
# Configuration created Tue Mar 16 23:31:58 1999 by fetchmailconf
set syslog
set idfile "/somelocaluser/.fetchids"
set postmaster "postmaster"
set invisible
poll mail.example.net with proto imap and options no dns
user "someuser" there with password "somepassword" is somelocaluser
here and wants mda "/usr/bin/procmail -d somelocaluser"
-----End of file----
Example .procmailrc using bogofilter
----${HOME}/.procmailrc----
:0 BH
* ? bogofilter -u
spam
:0:
${DEFAULT}
----End of file-----
Example .procmailrc using spamassassin
----${HOME}/.procmailrc-----
SPAMASSASSIN=/path/to/spamassassin
:0 f
| ${SPAMASSASSIN}
:0:
${DEFAULT}
----End of file----
SpamBouncer is a bit more complex to setup in a .procmailrc so I won't
go into that configuration here.
Or some combination.
Re: how to configure linux+postfix to pickup ISP email IMAP style
am 31.12.2006 23:27:50 von Andrew Marlow
On Sun, 31 Dec 2006 14:24:03 -0700, Garen Erdoisa wrote:
>> This is what I have been trying to do but I have had bad luck all day. No
>> matter how I try to configure procmail the system behaves as if procmail
>> is not invoked or involved.
>> Any ideas please? I am tearing my hair out!!!!
>
> I see. Well on my system, I just have fetchmail deliver directly to
> procmail, not involving postfix or anything else.
After struggling with this ALL DAY I eventually found out what the
problem was. Postfix does not work with procmail and/or a .forward file
when selinux is turned on. When it is turned off via the command
'setenforce 0' then I got forwarding to work. I am now looking into how to
setup my filter program to implement the kind of whitelist I want. The
clue was the "svc access denied" trace in /var/log/messages. IMO this was
not obvious. Thanks for your input though, and a happy new year!
-Andrew