Gutsy Postfix quota email fixed

Discussion in 'HOWTO-Related Questions' started by thecaoticone, Jan 24, 2008.

  1. thecaoticone

    thecaoticone New Member

    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/

    virtual_mailbox_extended = yes

    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:

    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 )
    Last edited: Jan 24, 2008
  2. thecaoticone

    thecaoticone New Member

    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!
  3. volksman

    volksman New Member

    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.....
  4. thecaoticone

    thecaoticone New Member

    Okay, attached below is my 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/

    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


    | 4 | [email protected] |


    View attachment main.txt
    Last edited: Jan 26, 2008
  5. volksman

    volksman New Member

    What is the ownership and privs on your maildirsize files?
  6. thecaoticone

    thecaoticone New Member

    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.
    Last edited: Jan 26, 2008
  7. thecaoticone

    thecaoticone New Member

    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
    1 entry for 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

    ifconfig (made sure virtual interface was running)

    reset the hostname:
    echo > /etc/hostname
    /etc/init.d/ start

    hostname -f

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

    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;


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

    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

    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 ('[email protected]', ENCRYPT('secret'), 10485760);

    INSERT INTO `users` (`email`, `password`, `quota`) VALUES ('[email protected]', ENCRYPT('secret'), 26214400);

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

    sent differnt sized messages to each user

    cd /home/vmail/

    find user1

    find user2

    find user3

    find user4

    no user/maildirsize file appeared for any of the users






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

    /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):

    result this time


    | 4 | [email protected] |
    | 3 | [email protected] |
    | 1 | [email protected] |


    user3 is still under 1% so he is not showing in the report.
    Last edited: Jan 26, 2008
  8. atjensen11

    atjensen11 New Member

    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.
  9. atjensen11

    atjensen11 New Member

    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?

  10. falko

    falko Super Moderator ISPConfig Developer

  11. atjensen11

    atjensen11 New Member


    A quick answer to your question is Yes. I did follow the 8.04 Virtual User How-To.

    I carefully reviewed the two How-To's (7.10 and 8.04) and there were only minor differences. When it came to the quota notifications, they appeared to be identical. That is why I posted here in this forum.

    To clarify, I am receiving emails daily with percentages reported. However, the maildirsize file that is placed in each user's mail folder is not being created or updated.

    Therefore, the only accounts reported in the quota notification are the ones that were moved over from the 7.10 server to the 8.04. They don't appear to have been updated since the move. Any new accounts created after the move to 8.04 never have the maildirsize file created and as such, don't show up in the quota notification.

  12. thecaoticone

    thecaoticone New Member

    I have also upgraded to 8.04, using falko's guide and making the same changes to to the /etc/postfix/ as I did in 7.10, and all is well.

    Did you reload or restart postfix after the change?
  13. falko

    falko Super Moderator ISPConfig Developer

    Did you disable AppArmor?
  14. atjensen11

    atjensen11 New Member

    Yes, I did disable AppArmor. I never can get BIND to start without errors unless I completely remove it, as Till had mentioned.

    I also did restart Postfix after the changes, then sent emails with the hopes that the maildirsize files would be created.

    Did you completely replace the old line with the change, or do you have both lines, one with "box" and one with "dir"?
  15. thecaoticone

    thecaoticone New Member

    I only change the one line.

    Below is my file for you to compare to your file.

    Maybe this will help.

    # See /usr/share/postfix/ for a commented, more complete version
    # Debian specific:  Specifying a file name will cause the first
    # line of that file to be used as the name.  The Debian default
    # is /etc/mailname.
    #myorigin = /etc/mailname
    smtpd_banner = $myhostname ESMTP $mail_name
    biff = no
    # appending .domain is the MUA's job.
    append_dot_mydomain = no
    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h
    readme_directory = /usr/share/doc/postfix
    # TLS parameters
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_use_tls = yes
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.
    myhostname =
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination =, localhost, localhost.localdomain
    relayhost = 
    mynetworks =
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    html_directory = /usr/share/doc/postfix/html
    virtual_alias_domains = 
    virtual_alias_maps = proxy:mysql:/etc/postfix/, mysql:/etc/postfix/
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/
    virtual_mailbox_base = /home/vmail
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    smtpd_sasl_auth_enable = yes
    broken_sasl_auth_clients = yes
    smtpd_sasl_authenticated_header = yes
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    transport_maps = proxy:mysql:/etc/postfix/
    virtual_create_maildirsize = yes
    virtual_maildir_extended = yes
    virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/
    virtual_mailbox_limit_override = yes
    virtual_maildir_limit_message = "The user you are trying to reach is over quota."
    virtual_overquota_bounce = yes
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps     $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps     $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
    content_filter = amavis:[]:10024
    receive_override_options = no_address_mappings
  16. atjensen11

    atjensen11 New Member

    Thanks, that helped a lot. I compared your file to mine and it exactly the same with the exception of the hostname, which is what I would expect.

    Yet, I still am not getting the maildirsize files created in the user's folders.

    I can only think of two changes I have made to my configuration that are different than the How-To and would not show up in the file.

    I installed Yaa through another tutorial here on How To Forge. That only required adding a table to the mail database.

    The other change was that I added a field to both the domain and user tables titled 'enabled'. I then modified the WHERE statement in the Postfix queries to ensure that the account was enabled before accepting mail.

    This wouldn't have anything to do with the problem I am experiencing now, would it? I can't see how that would matter, but I don't claim to be an expert on this.

  17. thecaoticone

    thecaoticone New Member


    Sorry for taking so long to respond.

    After reading your last post, I agree that the changes you made should not affect the quota report or the maildirsize file.

    Postfix should be taking care of this file every time a piece of mail is added or removed from the account.

    I wish I could be more helpful in solving this issue, however, at this point you have me scratching my head.

    If I can think of a possible solution, I will be sure to post.
  18. atjensen11

    atjensen11 New Member

    I finally got around to looking into this problem again tonight. I think I found what the problem was.

    I downloaded the Postfix source code again and rebuilt the package to have quota support. I then reinstalled the packages and all is well.

    Perhpas an apt-get upgrade command did something along the way and changed the Postfix packages back to the versions that don't support quota.

    I just thought I would post the solution in case anyone else comes along the same problem in the future.

    Thanks again for a great community forum.
  19. Oceanic

    Oceanic New Member

    Thanks atjensen11. I think I have the same problem as the maildirsize file are not being created.

    I woud be very grateful if you could provide details on how to download the source code and rebuild the package as I don't know how to do this and have alway relied on apt-get to install the packages. Also if you do this will it break the use of apt-get upgrade for security patches in the future?

    Many thanks
  20. kt3000

    kt3000 New Member

    I know that this topic is little out of date but I would like to share how to send notification about quota again after upgrading postfix.

    Just like atjensen11 said, problem occured when apt-get upgrade was made.
    After this, you need to patch your postfix and postfix-mysql package once again (it is described in section 3, first page of Gutsy tutorial).
    To prevent those two packages from upgrading in the future, you need to do:
    echo "postfix hold" | dpkg --set-selections
    echo "postfix-mysql hold" | dpkg --set-selections
    Sorry for taking out this old topic :) .

    Greetings from Poland!

Share This Page