Virtual Users And Domains With Postfix, Courier And MySQL (Ubuntu 6.10 Edgy Eft) - Page 5

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Tue, 2007-03-20 18:34. ::

11 Quota Exceedance Notifications

If you want to get notifications about all the email accounts that are over quota, then do this:

cd /usr/local/sbin/
wget http://puuhis.net/vhcs/quota.txt
mv quota.txt quota_notify
chmod 755 quota_notify

Open /usr/local/sbin/quota_notify and edit the variables at the top. Further down in the file (towards the end) there are two lines where you should add a % sign:

vi /usr/local/sbin/quota_notify

[...]

my $POSTFIX_CF = "/etc/postfix/main.cf";

my $MAILPROG = "/usr/sbin/sendmail -t";

my $WARNPERCENT = 80;

my @POSTMASTERS = ('postmaster@yourdomain.tld');

my $CONAME = 'My Company';

my $COADDR = 'postmaster@yourdomain.tld';

my $SUADDR = 'postmaster@yourdomain.tld';

my $MAIL_REPORT = 1;

my $MAIL_WARNING = 1;

[...]

           print "Subject: WARNING: Your mailbox is $lusers{$luser}% full.\n";

[...]

           print "Your mailbox: $luser is $lusers{$luser}% full.\n\n";

[...]

Run

crontab -e

to create a cron job for that script:

0 0 * * * /usr/local/sbin/quota_notify &> /dev/null

(Note (a little off-topic): on Ubuntu crontab -e will automatically open the editor nano. If you are used to working with the editor vi (like me), run the following commands:

rm -f /etc/alternatives/editor
ln -s /usr/bin/vi /etc/alternatives/editor

Afterwards, run crontab -e, and vi will come up.)

 

12 Test Postfix

To see if Postfix is ready for SMTP-AUTH and TLS, run

telnet localhost 25

After you have established the connection to your Postfix mail server type

ehlo localhost

If you see the lines

250-STARTTLS

and

250-AUTH

everything is fine:

root@server1:/usr/local/sbin# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 server1.example.com ESMTP Postfix (Ubuntu)
ehlo localhost
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.
root@server1:/usr/local/sbin#

Type

quit

to return to the system shell.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.