[Dovecot] Running a script when a mail arrives
Hi, I'm trying to execute a script when a mail arrives in a given user's mailbox. Something like .dovecot.sieve. The reason I'm not using sieve itself is that I need to do stuff on mail arrival, which is beyond sieve's features.
So is there a way to tell dovecot to run a script when a mail arrives in a certain mailbox? Optionally a solution to forward the whole mail to a script would be good too.
-- Dennis Becker
Dennis Becker wrote:
I'm trying to execute a script when a mail arrives in a given user's mailbox. Something like .dovecot.sieve. The reason I'm not using sieve itself is that I need to do stuff on mail arrival, which is beyond sieve's features.
I am not totally sure, being very new to dovecot, but doesn't dovecot's "deliver" execute the .dovecot.sieve if the sieve plugin is installed and configured?
protocol lda { # ... mail_plugins = cmusieve }
Seeing when the .dovecot.sievec is created, it looks like that is done on delivery time, not when reading.
Regards, Juergen.
This sounds like a better task to do at the MTA level. I know Postfix has the capability to do such things. You can write a Perl script for example and make entries in the main.cf and/or master.cf files and postfix will pass the e-mail to that script during the rest of it's processing.
Tom
Dennis Becker wrote:
Hi, I'm trying to execute a script when a mail arrives in a given user's mailbox. Something like .dovecot.sieve. The reason I'm not using sieve itself is that I need to do stuff on mail arrival, which is beyond sieve's features.
So is there a way to tell dovecot to run a script when a mail arrives in a certain mailbox? Optionally a solution to forward the whole mail to a script would be good too.
Hi,
This sounds like a better task to do at the MTA level. I know Postfix
We use qmails 'qmail-command' - feature. For a certain virtual domain all mails are filtered/sorted by a filterscript of our own. Check if your incoming mailserver or MTA has such a capability. For qmail its as simple as placing a .qmail -File in the users home directory with '|./path/to/scipt', the script getting the mail on its stdin, and some more useful information via the environment.
Greetz, Ruben
has the capability to do such things. You can write a Perl script for example and make entries in the main.cf and/or master.cf files and postfix will pass the e-mail to that script during the rest of it's processing.
Tom
Dennis Becker wrote:
Hi, I'm trying to execute a script when a mail arrives in a given user's mailbox. Something like .dovecot.sieve. The reason I'm not using sieve itself is that I need to do stuff on mail arrival, which is beyond sieve's features.
So is there a way to tell dovecot to run a script when a mail arrives in a certain mailbox? Optionally a solution to forward the whole mail to a script would be good too.
r.lang@scan-plus.de schrieb:
Hi,
This sounds like a better task to do at the MTA level. I know Postfix
We use qmails 'qmail-command' - feature. For a certain virtual domain all mails are filtered/sorted by a filterscript of our own. Check if your incoming mailserver or MTA has such a capability. For qmail its as simple as placing a .qmail -File in the users home directory with '|./path/to/scipt', the script getting the mail on its stdin, and some more useful information via the environment.
Greetz, Ruben
has the capability to do such things. You can write a Perl script for example and make entries in the main.cf and/or master.cf files and postfix will pass the e-mail to that script during the rest of it's processing.
Tom
Dennis Becker wrote:
Hi, I'm trying to execute a script when a mail arrives in a given user's mailbox. Something like .dovecot.sieve. The reason I'm not using sieve itself is that I need to do stuff on
arrival, which is beyond sieve's features.
So is there a way to tell dovecot to run a script when a mail arrives
in
a certain mailbox? Optionally a solution to forward the whole mail to
a
script would be good too.
Thanks to all. I went to the MTA level using a .forward in the user's homedir now.
The reason for not doing that in the first place, was that I have virtual accounts together with postfix, so there is actually no homedir for the mailuser. What I'm doing now is some kind of workaround. Since i just need to have the "passing the mail to a script" capability for one special user I can use a mailforward to the system vmail user and use the .forward in that homedir.
But I'm still confused why there's no possibility included to execute external scripts in a .dovecot.sieve solution.
-- Dennis Becker
Usualy I use maildrop capabilities to do such a thing.
Like qmail, it passes the message for the script stdin. It's a good way to have different bahaviour for different users, you can do a lot of filtering with maildropfilter language too.
You can try courier-maildrop if you have a virtual host enviroment where users do not have a home folder, in this case maildrop can read users information from a database. That is a great piece of code!
[]'s, Catunda!
Hi, I'm trying to execute a script when a mail arrives in a given user's mailbox. Something like .dovecot.sieve. The reason I'm not using sieve itself is that I need to do stuff on
!DSPAM:46f1263440901465223968!
On Wed, 2007-09-19 at 15:24 +0200, Dennis Becker wrote:
But I'm still confused why there's no possibility included to execute external scripts in a .dovecot.sieve solution.
That would be a really bad feature to have if the user doesn't have shell access. Also it would require changing the libsieve code to support this kind of a new extension, which I'd rather not do myself.
participants (6)
-
"Fábio M. Catunda"
-
Dennis Becker
-
Juergen Nickelsen
-
r.lang@scan-plus.de
-
Timo Sirainen
-
Tom