[Dovecot] Trigger getmail via mail-client action?
Hello,
I want to use dovecot on my private debian/unstable-system to have the advantages of an IMAP-Server (Access to mails from different computers, Simply changing the mail client). I decided to use dovecot, because I very often have read (in the web) that it should be more simple to configure than other servers.
Now I have the following question:
I want to use getmail to retrieve mails from my provider's pop3-server. I do have a dial-up-connection that is not online permanently (I do not have a flat rate). I could start a script on ppp's ip-up that periodically invokes getmail and on ip-down to kill it again. But I would prefer to invoke getmail only when I really want it to be run. The ideal solution for me was to invoke getmail when the "Get Mail"-Button of the mail client is pressed. Is this possible? Perhaps there is something like a connection- or refresh-trigger in dovecot?
Thank you,
Gert
On Sat, 26 Feb 2005, Gert Brinkmann wrote:
Hello,
I want to use dovecot on my private debian/unstable-system to have the advantages of an IMAP-Server (Access to mails from different computers, Simply changing the mail client). I decided to use dovecot, because I very often have read (in the web) that it should be more simple to configure than other servers.
Now I have the following question:
I want to use getmail to retrieve mails from my provider's pop3-server. I do have a dial-up-connection that is not online permanently (I do not have a flat rate). I could start a script on ppp's ip-up that periodically invokes getmail and on ip-down to kill it again. But I would prefer to invoke getmail only when I really want it to be run. The ideal solution for me was to invoke getmail when the "Get Mail"-Button of the mail client is pressed. Is this possible? Perhaps there is something like a connection- or refresh-trigger in dovecot?
I'm not sure if I understand your question. If you run dovecot on an internal machine, you can just let it run in the background, while 'getmail' does or doesn't get new emails. As long as 'getmail' knows how to put the emails in the correct place, i.e. a mailbox monitored by dovecot, there should be no problem as this is exactly what happens on any other machine with the MTA/MDA delivering and IMAP daemon serving email.
You might want to check your locking settings, though. Getmail's webpage seems to indicate that fcntl is used for locking. Check your dovecot.conf, it should be default.
Also read the wiki for more information:
http://wiki.dovecot.org/BasicInstall
It tells you about locking.
Wouter Van Hemel wrote:
it to be run. The ideal solution for me was to invoke getmail when the "Get Mail"-Button of the mail client is pressed. Is this possible? Perhaps there is something like a connection- or refresh-trigger in dovecot?
I'm not sure if I understand your question. If you run dovecot on an internal machine, you can just let it run in the background, while 'getmail' does or doesn't get new emails. As long as 'getmail' knows how to put the emails in the correct place, i.e. a mailbox monitored by dovecot, there should be no problem as this is exactly what happens on any other machine with the MTA/MDA delivering and IMAP daemon serving email.
Yes, all this is true and I did understand it. The thing is that the command "getmail" (or alternatively "fetchmail") has to be started from time to time so that new mails are pulled from the pop3 server into my "~/Maildir"-ectory that is monitored by dovecot.
My idea is that dovecot somehow could recognize when the user does press the "Get Mail" Button in the mail client (the mail client connects to dovecot). If this is the case dovecot could start an external command on each such an event. In my case I would let it invoke "getmail".
The advantage was that a) getmail is not invoked to often but only if I really want it to check for new mails and b) If I am waiting for a mail I do not have to wait for the next "getmail"-execution to see new incoming mails.
If dovecot cannot initiate some action on such an "Get Mail"-Button-Press-Event I alternatively have to include such a button into my window manager's toolbox or menu to call the command getmail directly.
Thank you,
Gert
Gert Brinkmann wrote:
it to be run. The ideal solution for me was to invoke getmail when the "Get Mail"-Button of the mail client is pressed. Is this possible? Perhaps there is something like a connection- or refresh-trigger in dovecot?
So, really, whenever a user logs into the IMAP server, you want to set a flag somewhere saying getmail should run.
From memory there is a config option that will run a script at login. You could use this to 'touch' a file somewhere. Then, put a script in cron which checks for this file (and perhaps its staleness), and upon finding it, runs getmail.
If dovecot does NOT have the login/logout triggered script, I believe I'm not the only person who thinks it would be a useful feature :)
Worst case, you'll have to write your own plugin to get this functionality... which isn't a big deal, from what I've seen. And if it comes to that, you could possibly make the plugin trigger getmail itself... I believe the config API is sufficient that you could make the script/parms/timing configurable.
-- Curtis Maloney cmaloney@cardgate.net
On Mon, 2005-02-28 at 09:58 +1100, Curtis Maloney wrote:
Gert Brinkmann wrote:
it to be run. The ideal solution for me was to invoke getmail when the "Get Mail"-Button of the mail client is pressed. Is this possible? Perhaps there is something like a connection- or refresh-trigger in dovecot?
So, really, whenever a user logs into the IMAP server, you want to set a flag somewhere saying getmail should run.
From memory there is a config option that will run a script at login. You could use this to 'touch' a file somewhere. Then, put a script in cron which checks for this file (and perhaps its staleness), and upon finding it, runs getmail.
It's not very useful only at login unless your IMAP client keeps reconnecting constantly. I've had Evolution keep the same IMAP session open for weeks.
Worst case, you'll have to write your own plugin to get this functionality...
Yep. That'd work. I'd hook SELECT, EXAMINE, STATUS and CHECK commands to execute getmail. Maybe NOOP too.
On Sun, 27 Feb 2005, Gert Brinkmann wrote:
[...] My idea is that dovecot somehow could recognize when the user does press the "Get Mail" Button in the mail client (the mail client connects to dovecot). If this is the case dovecot could start an external command on each such an event. In my case I would let it invoke "getmail".
[...]
I see. I've had a simlar problem a few years ago, although I already had a permanent internet connection. Rather than having to pull my mail in on my router every few minutes or so even when I wasn't reading it, I just wrote a little script that HUP's fetchmail with a shorter polling interval when my desktop machine was on (by pinging it).
Not completely what you were looking for, but perhaps an idea...
It would save you from writing a plugin, though.
participants (4)
-
Curtis Maloney
-
Gert Brinkmann
-
Timo Sirainen
-
Wouter Van Hemel