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