HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   Gutsy Postfix quota email fixed (http://www.howtoforge.com/forums/showthread.php?t=19765)

thecaoticone 24th January 2008 09:48

Gutsy Postfix quota email fixed
 
I finally found my notes with the fix for the empty quota E-mails. :D

Gutsy is now working.

Make this change to your /etc/postfix/main.cf

change:
virtual_mailbox_extended = yes

to:
virtual_maildir_extended = yes

then reload postfix.

For a fresh install, send a test e-mail to your account. ( I used an attachment that was more than 1% of my quota. )

then login to the server as root and do:
/usr/local/sbin/quota_notify


You should now have an e-mail listing all users at 1% or more and the percentage of the quota used.

You may need to delete the /user/maildirsize file and let Postfix replace it when a new e-mail arrives.

This solution might work for Edgy & Feisty servers that are already running.
I can not promise this as I have not tested it.



It's amazing how one little change can make a difference.

One down side I have found, if I delete a message in a pop3 client it will not remove the message from the server. This I have to do with an imap client like Squirrelmail. Once deleted with the imap client the quota is updated. (this may just be a setting in my pop3 client )

thecaoticone 25th January 2008 07:13

pop3 client update
 
The problem with deleting messages via pop3 client was the developers felt the need to change a few things in Thunderbird 2.0

All is well now!

volksman 25th January 2008 16:30

Well here's the weird thing. I wrote that little script to manually build the maildirsize file on my system. I checked my maildirsize file before I made the above change and it was in the correct format (IE postfix or something else had modified it). Regardless I made the change to the config (box to dir) and restarted postfix. Sent myself an e-mail and nothing changed in the file. Deleted the file to let postfix re-create it (after sending myself a test). It did not.

So I ran my maildirfix script again and it created the maildirsize file. Sent myself an e-mail and Postfix updated the maildirsize file!?!

Something is weird here.....

thecaoticone 25th January 2008 18:29

1 Attachment(s)
Okay, attached below is my main.cf file. The only thing I changed was the "box to dir".

The steps I took were:

1) box to dir

2) /etc.init.d/postfix reload

3) cd /home/vmail/domain.com

4) rm -rf user/maildirsize

5) send an email to user

6) nano user/maildirsize (made sure it was replaced)

7) /usr/local/sbin/quota_notify

8) received quota email

DAILY QUOTA REPORT:

----------------------------------------------
| % USAGE | ACCOUNT NAME|
----------------------------------------------
| 4 | user@domain.com |
---------------------------------------------

--
domain


Attachment 682

volksman 25th January 2008 19:00

What is the ownership and privs on your maildirsize files?

thecaoticone 26th January 2008 05:06

File Permissions
 
Here is the result "ls -l" on one my regular users.

-rw------- 1 vmail vmail 21 2008-01-25 20:43

One thing I caught in you first response:

"Deleted the file to let postfix re-create it (after sending myself a test). It did not."

Sorry if I did not explain it clearly, but you need to delete the maildirsize file before sending the test e-mail. Then after the e-mail arrives, check to see if Postfix re-created the maildirsize file.

If we can get Postfix to create the file, then it should update when mail arrives to / removed from the server.

The problem I had was Postfix failed to create the file at all, which seems to be the same problem you are having.

thecaoticone 26th January 2008 19:17

Re-installed Gutsy
 
Just to make sure I am not leading you to an incorrect answer, I just re-installed Gutsy.

I used Falko's guide with following changes:

During setup installed:
LAMP server
Openssh server

edited /etc/hosts
1 entry for localhost.localdomain localhost
1 entry for server.domain.com server
1 entry for mail.domain.com mail (added as sub-domain in DNS)



edited /etc/network/interfaces
eth0 for server
eth0:0 for mail

restarted network
/etc/init.d/networking restart

did:
ifconfig (made sure virtual interface was running)


reset the hostname:
echo server.domain.com > /etc/hostname
/etc/init.d/hostname.sh start

hostname
hostname -f


edited /etc/apt/sources.list
commented out the "deb: cdrom" line

did:
apt-get update
apt-get upgrade



Changed quota size to 25 MB

CREATE TABLE users (
email varchar(80) NOT NULL,
password varchar(20) NOT NULL,
quota INT(10) DEFAULT '10485760',
PRIMARY KEY (email)
) TYPE=MyISAM;

to:

CREATE TABLE users (
email varchar(80) NOT NULL,
password varchar(20) NOT NULL,
quota INT(10) DEFAULT '26214400',
PRIMARY KEY (email)
) TYPE=MyISAM;


Changed:
apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 unzoo libnet-ph-perl libnet-snpp-perl libnet-telnet-perl nomarch lzop pax

to:
apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 unzoo libnet-ph-perl libnet-snpp-perl libnet-telnet-perl nomarch lzop pax lha arj unrar cabextract



Changed for 25 MB quota:
INSERT INTO `users` (`email`, `password`, `quota`) VALUES ('sales@example.com', ENCRYPT('secret'), 10485760);

to:
INSERT INTO `users` (`email`, `password`, `quota`) VALUES ('sales@example.com', ENCRYPT('secret'), 26214400);



created user1, user2, user3, user4, and postmaster in mail database

sent differnt sized messages to each user

did:
cd /home/vmail/domain.com

find user1

find user2

find user3

find user4

no user/maildirsize file appeared for any of the users

did:
/usr/local/sbin/quota_notify


result:

DAILY QUOTA REPORT:

----------------------------------------------
| % USAGE | ACCOUNT NAME |
----------------------------------------------

--
domain


made the "virtual_mailbox_extended = yes" to "virtual_maildir_extended = yes" change in /etc/postfix/main.cf

did:
/etc/init.d/postfix reload

re-sent the emails to the users

re-issued the find command for each user

now user/maildirsize shows up in all the users

did (again):
/usr/local/sbin/quota_notify


result this time

DAILY QUOTA REPORT:

----------------------------------------------
| % USAGE | ACCOUNT NAME |
----------------------------------------------
| 4 | user4@domain.com |
---------------------------------------------
| 3 | user2@domain.com |
---------------------------------------------
| 1 | user1@domain.com |
---------------------------------------------

--
domain


user3 is still under 1% so he is not showing in the report.

atjensen11 23rd April 2008 06:58

I just wanted to say thanks. I too had followed Falko's guide and was wondering why I wasn't receiving the quota information.

I implemented this change in about thiry seconds and was off and running like new.

Thanks to all who make this site as good as it is.

atjensen11 7th July 2008 20:53

Since my last posting here, I have rebuilt my server using Ubuntu 8.04 LTS. I had completely forgotten about the quota patch I had applied from this thread earlier.

I soon noticed that my daily Quota reports did not seem to be changing and in particular, new users were not showing up in the reports. I checked and the maildirsize files are not be created.

So I applied the patch to the new server and sent some test emails. Again, the maildirsize files were not created. I then created a blank maildirsize file and sent emails to see if the file would be updated. It was not.

So it appears that the patch works in the 7.10 version of Ubuntu, but not the 8.04.

Any suggestions?

Thanks.

falko 8th July 2008 14:42

Have you tried this tutorial? http://www.howtoforge.com/virtual-us...ail-ubuntu8.04


All times are GMT +2. The time now is 13:54.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.