The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do you limit the days email stays in queue?

Discussion in 'E-mail Discussions' started by DWHS.net, Jul 9, 2010.

  1. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    I think by default it's 6 days.

    I would like 3 or maybe even two.

    I think this is done with the exim advanced editor but I am not sure what to edit there.
     
  2. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    Go to Advanced Editor, scroll down to the end, you will see the following

    Code:
    ######################################################################
    #                      RETRY CONFIGURATION                           #
    ######################################################################
    
    # This single retry rule applies to all domains and all errors. It specifies
    # retries every 15 minutes for 2 hours, then increasing retry intervals,
    # starting at 1 hour and increasing each time by a factor of 1.5, up to 16
    # hours, then retries every 8 hours until 4 days have passed since the first
    # failed delivery.
    
    # Domain               Error       Retries
    # ------               -----       -------
    
    
    begin retry
    
    
    *                      *           F,2h,15m; G,16h,1h,1.5; F,4d,8h
    
    The last entry is hard coded in exim, so you cannot change it, but you can control tries to some extend.

    Example
    Code:
    *       refused         F,2h,15m; F,6h,1h
    *       timeout         F,2h,15m; F,6h,1h
    
    You can read about it more at Exim Specification - 33. Retry configuration, and customize it as per your requirement.
     
  3. Miraenda

    Miraenda Well-Known Member

    Joined:
    Jul 28, 2004
    Messages:
    242
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Coralville, Iowa USA
    Another option would be simply to clear the old emails using a cron. This would clear emails once a day that are 3 days or older from the mail queue:

    Code:
    0 1 * * * exiqgrep -io 259200 | xargs exim -Mrm
    The cron will run at 1:00am server time to remove from the queue messages 259200 seconds old which is 3 days time (-io is Message ID older than). If you wanted it to be only two days, change 259200 to 172800 instead.

    For the cron, you could put it into crontab -e and it will automatically run at 1:00am from then on. Crontab -e is the root crontab at /var/spool/cron/root location.

    This would probably be simpler for most people over changing the exim defaults in areas of the advanced editor that cPanel won't allow to be edited.
     
    #3 Miraenda, Jul 10, 2010
    Last edited: Jul 10, 2010
  4. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    Sorry, but not a good option. If you do it this way, your users will never know if a message was bounced back / reason for any message to be stuck in the queue. As per standards, you should bounce the mail back to the server. Ofcourse incase the sender is a spam address, in that case you would have to follow the above route and delete the message.

    Instead of delete, its always preferred to first try and bounce the message off.
     
  5. Miraenda

    Miraenda Well-Known Member

    Joined:
    Jul 28, 2004
    Messages:
    242
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Coralville, Iowa USA
    It is always better to not change exim defaults either and let it default to bounce when it should, go through the queue to see why it delayed and fix the issues.

    Whether it's a good option or not (clearing and deleting anything on the machine for error logs or cron clearing /tmp files for example, which people frequently do whether it's a good idea or not), the user asked how to perform this specific task. This option of clearing the queue is the only way to do it when the exim configuration editor won't allow the change for the default values.
     
    #5 Miraenda, Jul 10, 2010
    Last edited: Jul 10, 2010
  6. jmginer

    jmginer Well-Known Member

    Joined:
    Jul 26, 2006
    Messages:
    91
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Benifato, Spain
    This is the default value

    Code:
    # This single retry rule applies to all domains and all errors. It specifies
    # retries every 15 minutes for 2 hours, then increasing retry intervals,
    # starting at 1 hour and increasing each time by a factor of 1.5, up to 16
    # hours, then retries every 8 hours until 4 days have passed since the first
    # failed delivery.
    
    Code:
    *                      *           F,2h,15m; G,16h,1h,1.5; F,4d,8h
    
    As I want a max lifetime queue of 1 hour (emails with +1h in queue return to sender mail delivery error)

    Code:
    *                      *           F,15m,5m; G,30m,15m,1.5; F,1h,30m
    
    But seems don't take effect, I'm still seeing emails in my queue with +6 hours in queue.

    What is wrong?
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Could you verify which method you used to modify the existing value?

    Thank you.
     
Loading...

Share This Page