[Dovecot] quota-warning.sh mail from
Hello all
How Dovecot 1.1.3 quota script understand to who send a mail?
In try to do this:
In conf: quota_warning = storage=80%% /usr/local/bin/quota-warning.sh 80 %u@%d
In logs: IQuota warning: bytes=168611020 (80%) messages=0 (0%) command=/usr/local/bin/quota-warning.sh 80 dump-capability@
*what is dump-capability@ ? OS related user?...*
#cat quota-warning.sh
#!/bin/sh
PERCENT=$1 TO=$2
echo "Your mailbox is $PERCENT% full. If it overfill - you will can not get new email. Please clean up your mailbox.
-- Mail Administator" | /usr/bin/mail -s "Email mailbox is $PERCENT% full" $TO -f postmaster@domain.off
exit 0
Im thinking in wrong way?
-- Best regards, Proskurin Kirill
On Thu, 2008-10-16 at 18:00 +0400, Proskurin Kirill wrote:
Hello all
How Dovecot 1.1.3 quota script understand to who send a mail?
In try to do this:
In conf: quota_warning = storage=80%% /usr/local/bin/quota-warning.sh 80 %u@%d
You probably want just %u since it has both user@domain.
In logs: IQuota warning: bytes=168611020 (80%) messages=0 (0%) command=/usr/local/bin/quota-warning.sh 80 dump-capability@
*what is dump-capability@ ? OS related user?...*
dump-capability is run once at startup so Dovecot can figure out what IMAP capabilities are supported by the loaded plugins. You should just ignore that dump-capability check.
Timo Sirainen wrote:
In conf: quota_warning = storage=80%% /usr/local/bin/quota-warning.sh 80 %u@%d
You probably want just %u since it has both user@domain.
In logs: IQuota warning: bytes=168611020 (80%) messages=0 (0%) command=/usr/local/bin/quota-warning.sh 80 dump-capability@
*what is dump-capability@ ? OS related user?...*
dump-capability is run once at startup so Dovecot can figure out what IMAP capabilities are supported by the loaded plugins. You should just ignore that dump-capability check.
Ok.
dovecot.conf:
quota = maildir quota_rule = *:storage=201M quota_rule2 = Trash:storage=202M quota_rule3 = SPAM:ignore quota_warning = storage=95%% /usr/local/bin/quota-warning.sh 95 %u quota_warning2 = storage=80%% /usr/local/bin/quota-warning.sh 80 %u quota_warning3 = storage=99%% /usr/local/bin/quota-warning.sh 99 %u
mx# /usr/local/etc/rc.d/dovecot restart
Stopping dovecot. Starting dovecot. ILoading modules from directory: /usr/local/lib/dovecot/imap IModule loaded: /usr/local/lib/dovecot/imap/lib10_quota_plugin.so IModule loaded: /usr/local/lib/dovecot/imap/lib11_imap_quota_plugin.so IEffective uid=65534, gid=65534, home= IQuota root: name= backend=maildir args= IQuota rule: root= mailbox=* bytes=210763776 (0%) messages=0 (0%) IQuota rule: root= mailbox=Trash bytes=211812352 (0%) messages=0 (0%) IQuota rule: root= mailbox=SPAM ignored IQuota warning: bytes=200225587 (95%) messages=0 (0%) command=/usr/local/bin/quota-warning.sh 95 dump-capability IQuota warning: bytes=168611020 (80%) messages=0 (0%) command=/usr/local/bin/quota-warning.sh 80 dump-capability IQuota warning: bytes=208656138 (99%) messages=0 (0%) command=/usr/local/bin/quota-warning.sh 99 dump-capability
#cat quota-warning.sh:
#!/bin/sh
PERCENT=$1 TO=$2
echo "Your mailbox is $PERCENT% full. If it overfill - you will can not get new email. Please clean up your mailbox.
-- Mail Administator" | /usr/bin/mail -s "Email mailbox is $PERCENT% full" $TO -f postmaster@domain.off
exit 0
But im still got this message with mail from "dmail@mx.domain.off" *dmail it is user dovecot deliver runnig from*
If im run quota-warning.sh cript by hands - im got postmaster@domain.off in mail from. What im do wrong?..
-- Best regards, Proskurin Kirill
On 10/20/2008 10:28 AM, Proskurin Kirill wrote:
#cat quota-warning.sh:
#!/bin/sh
PERCENT=$1 TO=$2
echo "Your mailbox is $PERCENT% full. If it overfill - you will can not get new email. Please clean up your mailbox.
-- Mail Administator" | /usr/bin/mail -s "Email mailbox is $PERCENT% full" $TO -f postmaster@domain.off
exit 0
But im still got this message with mail from "dmail@mx.domain.off" *dmail it is user dovecot deliver runnig from*
If im run quota-warning.sh cript by hands - im got postmaster@domain.off in mail from. What im do wrong?..
I'm not sure that you can have that multiline echo ... Anyway, try the following which uses sendmail -f to set the From Address..
#!/bin/bash # PERCENT=$1
FROM="postmaster@support.off" qwf="/tmp/quota.warning.$$"
echo "Date: date
" >> $qwf
echo "From: $FROM" > $qwf
#echo "To: $USER" >> $qwf
echo "Subject: Mailbox size warning" >> $qwf
echo "" >> $qwf
echo "You are now using $PERCENT% of your mailbox quota." >> $qwf
echo "If you reach 100%, new mail will not be delivered to you." >> $qwf
echo "Please cleanup your mailbox." >> $qwf
echo "-- " >> $qwf
echo " Your Mail Administrator." >> $qwf
cat $qwf | /usr/sbin/sendmail -f $FROM "$USER"
rm -f $qwf
exit 0
Oh. I make my question more short.
In example on wiki we see such command:
/usr/sbin/sendmail "$USER"
As I understand $USER - it is system env mean current login user. I could not understand still how dovecot understand to whom deliver a mail? I dont see it on this example.
My script work but "mail from" - is a dovecot user but I want see in "mail from" postmaster of my domain.
Sotiris Tsimbonis wrote:
On 10/20/2008 10:28 AM, Proskurin Kirill wrote:
#cat quota-warning.sh:
#!/bin/sh
PERCENT=$1 TO=$2
echo "Your mailbox is $PERCENT% full. If it overfill - you will can not get new email. Please clean up your mailbox.
-- Mail Administator" | /usr/bin/mail -s "Email mailbox is $PERCENT% full" $TO -f postmaster@domain.off
exit 0
But im still got this message with mail from "dmail@mx.domain.off" *dmail it is user dovecot deliver runnig from*
If im run quota-warning.sh cript by hands - im got postmaster@domain.off in mail from. What im do wrong?..
I'm not sure that you can have that multiline echo ... Anyway, try the following which uses sendmail -f to set the From Address..
-- Best regards, Proskruin Kirill
Proskurin Kirill wrote, On 10/20/2008 06:27 PM:
Oh. I make my question more short.
In example on wiki we see such command:
/usr/sbin/sendmail "$USER"
As I understand $USER - it is system env mean current login user. I could not understand still how dovecot understand to whom deliver a mail? I dont see it on this example.
$USER means current user..
My script work but "mail from" - is a dovecot user but I want see in "mail from" postmaster of my domain.
You use /usr/bin/mail, which does not accept -f "from" as a parameter to set the "From" header.. On the other hand, /usr/sbin/sendmail does..
See again the example script I posted earlier, that allows you to send multiline warnings with custom from.. http://www.dovecot.org/list/dovecot/2008-October/034507.html
Sot.
Sotiris Tsimbonis wrote:
On 10/20/2008 10:28 AM, Proskurin Kirill wrote:
#cat quota-warning.sh:
#!/bin/sh
PERCENT=$1 TO=$2
echo "Your mailbox is $PERCENT% full. If it overfill - you will can not get new email. Please clean up your mailbox.
-- Mail Administator" | /usr/bin/mail -s "Email mailbox is $PERCENT% full" $TO -f postmaster@domain.off
exit 0
But im still got this message with mail from "dmail@mx.domain.off" *dmail it is user dovecot deliver runnig from*
If im run quota-warning.sh cript by hands - im got postmaster@domain.off in mail from. What im do wrong?..
I'm not sure that you can have that multiline echo ... Anyway, try the following which uses sendmail -f to set the From Address..
Sotiris Tsimbonis wrote:
Proskurin Kirill wrote, On 10/20/2008 06:27 PM:
Oh. I make my question more short.
In example on wiki we see such command:
/usr/sbin/sendmail "$USER"
As I understand $USER - it is system env mean current login user. I could not understand still how dovecot understand to whom deliver a mail? I dont see it on this example.
$USER means current user..
My script work but "mail from" - is a dovecot user but I want see in "mail from" postmaster of my domain. You use /usr/bin/mail, which does not accept -f "from" as a parameter to set the "From" header.. On the other hand, /usr/sbin/sendmail does..
Hm sorry but mail program clearly understand -f param. %echo test | mail -s "Email mailbox is 1 full" proskurin-kv@domain.off -f itiswork@domain.off
Here is email:
Return-path: itiswork@domain.off Envelope-to: proskurin-kv@domain.off Delivery-date: Tue, 21 Oct 2008 12:34:59 +0400 Received: from root by mx.domain.off with local (Exim 4.69 (FreeBSD)) (envelope-from itiswork@domain.off) id 1KsChf-000L2u-46 for proskurin-kv@domain.off; Tue, 21 Oct 2008 12:34:59 +0400 To: proskurin-kv@domain.off Subject: Email mailbox is 1 full Message-Id: E1KsChf-000L2u-46@mx.domain.off From: itiswork@domain.off Date: Tue, 21 Oct 2008 12:34:59 +0400
test
-- Best regards, Proskurin Kirill
Proskurin Kirill wrote, On 10/21/2008 11:36 AM:
Sotiris Tsimbonis wrote:
Proskurin Kirill wrote, On 10/20/2008 06:27 PM:
Oh. I make my question more short.
In example on wiki we see such command:
/usr/sbin/sendmail "$USER"
As I understand $USER - it is system env mean current login user. I could not understand still how dovecot understand to whom deliver a mail? I dont see it on this example.
$USER means current user..
My script work but "mail from" - is a dovecot user but I want see in "mail from" postmaster of my domain. You use /usr/bin/mail, which does not accept -f "from" as a parameter to set the "From" header.. On the other hand, /usr/sbin/sendmail does..
Hm sorry but mail program clearly understand -f param. %echo test | mail -s "Email mailbox is 1 full" proskurin-kv@domain.off -f itiswork@domain.off
Ok, fair enough (my "mail" does not understand -f to set From)... Maybe you've got different "mail" executables in your path and the script's default path?
See output of "whereis mail" ..
Even better, run "which mail" on your shell, and put the full path in your script..
Sotiris.
Here is email:
Return-path: itiswork@domain.off Envelope-to: proskurin-kv@domain.off Delivery-date: Tue, 21 Oct 2008 12:34:59 +0400 Received: from root by mx.domain.off with local (Exim 4.69 (FreeBSD)) (envelope-from itiswork@domain.off) id 1KsChf-000L2u-46 for proskurin-kv@domain.off; Tue, 21 Oct 2008 12:34:59 +0400 To: proskurin-kv@domain.off Subject: Email mailbox is 1 full Message-Id: E1KsChf-000L2u-46@mx.domain.off From: itiswork@domain.off Date: Tue, 21 Oct 2008 12:34:59 +0400
test
Sotiris Tsimbonis wrote:
Ok, fair enough (my "mail" does not understand -f to set From)... Maybe you've got different "mail" executables in your path and the script's default path?
See output of "whereis mail" ..
Even better, run "which mail" on your shell, and put the full path in your script..
I have only one mail program. Anyway - I try this:
#!/bin/sh
PERCENT=$1
echo "From: \"Quota Subsystem\" postmaster@domain.off To: $USER Subject: E-Mail Quota Warning Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 8bit
Your mailbox is $PERCENT% full. If it overfill - you will can not get new email. Please clean up your mailbox.
-- Mail Administator" | /usr/sbin/sendmail $USER
And all ok. But I have this headers: Return-path: dmail@mx.domain.off Envelope-to: proskurin-kv@domain.off Delivery-date: Tue, 21 Oct 2008 13:56:03 +0400 Received: from dmail by mx.domain.off with local (Exim 4.69 (FreeBSD)) (envelope-from dmail@mx.domain.off) id 1KsDy7-000L9d-0H for proskurin-kv@domain.off; Tue, 21 Oct 2008 13:56:03 +0400 From: "Quota Subsystem" postmaster@domain.off TO: proskurin-kv@domain.off Subject: E-Mail Quota Warning Sender: Dovecot Mail dmail@mx.domain.off
As you see - it have sender header and dont looks good im clients MUA. But it is a "problem" of my MTA and not for this list.
P.S. Oh. All I ask it is to explain HOW launch of quota-warning.sh work to make me free to write my own script.
Anyway - thank you for you answers.
-- Best regards, Proskurin Kirill
participants (3)
-
Proskurin Kirill
-
Sotiris Tsimbonis
-
Timo Sirainen