Mailbox quota exceeded – How cPanel manages mailbox quotas?


This applies to cPanel Web Hosting account and configuration of this is done by System Administrator with root privilege.

When you have an email account with certain amount of disk space quota, and it goes full, you have the option to either keep the mails in the queue or return them to the sender. The problem with keeping the emails in the queue for over quota email accounts is that it will clutter the queue of server with large number of emails. And most importantly neither the sender of the email nor recipient will know there is a problem with mailbox quota and it has exceeded.

To reject emails on over quota at the time sender’s remote server is delivering email to your hosting account is the best option as this will instantly inform the sender the mailbox is full. The sender can then either contact recipient via other means or try again later.

Mailbox Quota

This is configured in WHM’s Exim Configuration Manager by setting the value of Reject mail for users over quota to On.

With this configuration set, when the email account is over quota, new emails are not accepted by the server for that mailbox and it gives this error that you can see in /var/log/exim_mainlog:

2013-10-24 07:17:45 1VZ4sD-0000ab-11 ** email@example.org R=virtual_user_maildir_overquota: Mailbox quota exceeded

Important Note: In cPanel interface when you look up the disk space usage of email accounts, they get instantly updated with emails coming in or being deleted. This process is handled by the incoming and outgoing mail servers (exim, dovecot etc.). However for the purpose of checking disk space when receiving emails, cPanel re-calculates the disk usage every four hours and then uses that cached value for the next four hours. If it had to check each and every mailbox each second it is trying to deliver mail, the server would not be able to handle it. And it would also not allow temporary quota issues to be resolved where clients download emails regularly to make room. Therefore there is a small window when emails will be received for over quota accounts even with this configuration of rejecting emails for users over quota. Those emails are held in queue and on the next try they are delivered.

Email Filtering in cPanel Web Hosting


In this tutorial we are going to explain what is email filtering and best practice to use it. We have found through experience, if this feature is not used properly, you can lose important emails. Please pay close attention to the filter rules and make them as explicit as possible. Loosely defined rule can filter more emails than you may have originally intended.

We start by assuming that you have already logged into your cPanel account. There are two icons in the Mail section of cPanel as shown marked in the screen shot below:

Account and User Level Filters

Account Level Filtering: The rules created under here apply to all incoming emails for your domain. The rules here are processed first before going to User Level Filtering. If you want a rule to apply to all emails, you will create them here.

User Level Filtering: As the name implies, here you can set filter rules for individual email accounts. You can create rules that are for specific email addresses and will not have any impact on others. If there is a particular email that is having too much junk email, you can create rules here for it.

The rule creation is same for both levels so we’ll just talk about it once below. Let’s go to Account Level Filtering by clicking the icon.

All Email Filters

You have two options here. You can Create a New Filter or Test Filter. Let’s create a filter first and then we’ll test it. Click on the button Create a New Filter:

Email Filter Creation Step 1

When creating filters, please choose a specific Filter Name. In the example above, we are creating Mortgage Filter to filter emails about mortgage.

Under Rules you can add as many rules as you like by clicking on the + sign in front of the rule. The rules are processed one by one and based on the condition (and / or) the rules are matched with the incoming email. The rules can apply to specific parts of email: From, Subject, To, Reply Address, Body, Any header, Any recipient etc. And you can set the condition for the rule such as equals, matches regex (this is advance feature of regular expressions), contains, does not contain, begins with, ends with etc.

Mortgage Filter Rule: For the example here we are creating a rule that if we find the word “mortgage” in the subject line of emails, and the email comes for any of the three free email providers (yahoo.com, hotmail.com, gmail.com) then we will discard the email.

Email Filter Creation Step 2

Actions: There are a number of actions you can take and can also create multiple actions for each filter by using the plus sign. If you do not want to receive the emails that match the rule, “Discard Message” is the best option. If you choose “Fail with message”, it will try to send email back to the spammer which can be spoofed and your message may go to an innocent recipient who may not have originally sent that email. That is why we recommend that you choose Discard Message to simply drop the message and take no further action.

Now you can read the entire rule set as Subject contains mortgage and From contains yahoo.com or From contains hotmail.com or From contains gmail.com

You can be very creative here but if your filter is too generic, anything can be caught in it. For example if you try to match a small word but it is also part of a larger word then the rule will work and filter other emails as well. Example: Test will match Testing if your condition is “contains” because Testing contains Test.

Click Create button to create your new filter. You’ll get a message that filter has been created. Click on “return to the filters list” to see your new filter listed.

Email Filter Created

Let’s create another filter. This time we are going to filter a phrase from the spam we just received. The body of the email contains “% Off Retail Prices”.

Shopping Filter

Now we have two filters. We can re-order the filters by dragging any filter row up or down the list. The ordering is important as these filers are applied to incoming emails in the order they are listed here.

Filters List

Testing Filters

You should always test your email filters to make sure they are working as intended. The Filter Test text area allows you to compose a test email. You can set To, From, Subject and the body of the email and click Test Filter to test that email.

Let’s test our filters. First we are going to test if the email is coming from your bank and is talking about mortgage. Change the From to your bank’s domain. And add the word mortgage in subject.

Test Email Filter 1

When we click Test Filter, the result shows that “header_subject” matches our keyword mortgage. However that was not the only rule in that filter, the rule set also said and From contains one of those free email providers. So it says Normal delivery will occur.

Test Email Filter 1 Result

Let’s test it again and this time change the From email address by using one of the free email providers we added in our rules.

Test Email Filter 2

When we test it this time, the rules match and it says “Save message to: /dev/null 0660”. This indicates that the message will be discarded to bit bucket of /dev/null. And the last line that says “No other deliveries will occur” means there is no further action.

Test Email Filter 2 Result

That is all it is to email filtering. Happy filtering! Let us know if you face any problem or need any assistance.

Setup Email Forwarding in cPanel


Forwarders allow you to send a copy of all mail from one email address to another. For example, if you have two different email accounts, joe@example.com and joseph@example.com, you could forward joe@example.com to joseph@example.com so that you do not need to check both accounts. Or you can send it to multiple addresses for example info@example.com could be forwarded to two or more people. Note that the forwarded mail will still be delivered to the original address if it exists. You do not need to create the original email account if you are only forwarding it to other addresses and will not be using it to send email.

Important Note: We do not recommend using this feature for setting up email forwarding from your email address on the hosting server to an email provider elsewhere. The reason is that any spam received on your email will pass through as it is to the destination address. The server at the receiving end will consider your cPanel hosting server to be the source of that spam delivering it to their server. We recommend that proper email accounts should be created and email should be fetched using POP3 or IMAP.

Simple Email Forwarder

Email Forwarding

When you are logged into cPanel, click on Forwarders in the section Mail.

Email Forwarders

There is a video tutorial there that explains the steps to create Email Forwarder.

It lists currently configured email forwarders. You can forward one email address to multiple recipients.

Click Add Forwarder to go to next screen to setup new email forwarding:

Add Email Forwarding

In Address to Forward: type the required email address that you are forwarding from. In the above example we are using support address on our domain businessx.com.

Under Destination you have a choice of

a) Forward it to another email address (it can be an email address at another domain or on the same domain). This is typical setup.

b) Discard the email with error message e.g. when that email address no longer exists (someone left the company and email has been turned off).

If you click on Advanced Options, the area will expand. We explain these options below:

Email Forwarding Advanced Options

c) Forward to a system account (this should never be used)

d) Pipe to a Program: This is an advanced feature. You can forward the incoming email on this address to a software (script) that can process the email and take an action. Some web applications require you to setup such pipe, which means forwarding all emails to a script. This is explained later in this tutorial.

e) Discard (Not Recommended) as said this is not recommended and should not be used. We hope cPanel will one day remove this feature! 🙂

Once you are done with the choice, click Add Forwarder button to create the new email forwarding.

Email Forwarding Added

Your new forwarder is created. Click Go Back to go back to the Forwarders screen.

List of Email Forwarders

You can see your new forwarder in the list of forwarders. You can delete the forwarder. You cannot edit it. If you need to modify an existing forwarder, simply delete it and add a new one.

Using Trace link you can find out if the email resolves correctly or if there is an issue with underlying email setup of your domain.

Forward All Email for a Domain

There is another feature available on Forwarders screen in cPanel called Domain Forwarder. This feature allows all mail sent to a domain to be forwarded to another domain. You can use this feature if you have a parked domain but do not have any email configured for it, and would like emails addressed to that domain go to your primary domain. Domain forwarding takes place only when a delivery is not successful on that domain. For example, a user sends an email to john@example1.com. If john@example1.com is an existing email address or auto responder, then the email will not be forwarded. The email will be forwarded if john@example1.com is not an existing email address or auto responder.

Forward All Email for a Domain

Click on Add Domain Forwarder to continue:

Add a New Domain Forwarder

Select the domain from the drop down for which you want emails forwarded to another and then enter the other domain in the text box where you want those forwarded, and click Add Domain Forwarder to finish.

How to use the Pipe to Program Option

When creating simple email forwarder, there is an advanced option to send that email to a program. This is called email piping to program. When you use the pipe to program option, enter a path relative to your home directory for your script. For example, if your cPanel username is ‘john’, and your script is in your home directory at/home/john/script.pl, you would enter this in the Pipe to a Program box: test.pl

To ensure the script will work, the script must be executable. The hashbang line must also exist at the top of the script

  1. If you are using PHP, this should be the hashbang line at the top of the script: #!/usr/local/bin/php -q
  2. If you are using Perl, this should be the hashbang line at the top of the script: #!/usr/bin/perl

If a hashbang is not in your script, enter the path to the Perl or PHP interpreter in the Pipe to a Program box. This should be followed by the full path to the script:

  1. Perl users run this command: /usr/bin/perl /home/john/test.pl
  2. PHP users run this command: /usr/local/bin/php /home/john/test.php

If you are using PHP, ensure that your code is appropriately wrapped in start and end tags.

Make sure that your script uses the proper file permissions (0700). To change your script’s file permissions: chmod 0700 myscript.php where myscript.php is meant to stand for your script’s location and file name.

Let us know if you face any problem or if you have any comments.

Setup an Email AutoResponder in cPanel


You can use auto responders to send a message back automatically to anyone who sends an email to a specified email account. This feature is mostly used when you are on vacation and cannot check emails regularly.

Important Note: We do not recommend using this feature for setting up permanent autoresponder on an email address. The reason is that spammers use spoofed email address  (fake or other users emails) to send spam. When such a junk email reaches your auto-reponder, the reply back will go to the actual user. That user may not have sent the email. That email recipient will get annoyed on receiving that response.

Web Hosting - cPanel Auto Responder

Once you are logged into cPanel, click Auto Responders under section Mail.

Click Add Auto Responder cPanel Web Hosting

There is a video tutorial on the next page on how to setup Auto Responder. We’ll show you how to do it here in this post.

Click Add Auto Responder to go the next screen:

Add Auto Responder

Leave the Character Set to utf-8. Change it only if you know what you are doing. This is advanced feature for different languages.

Set Interval to 24 hours or more. This way you will not annoy the same person on several emails they may send you during the day. One response a day would be good enough (e.g. if you are out of office or on vacation) to let them know.

Enter the email address for which you want to set auto-responder, by typing the part before @ and selecting your email domain from the drop down.

Enter the same email address in front of From to send response from the same email address.

Enter the Subject of your email e.g. Out of Office for a Week (Oct 21-26)

Select This message contains HTML only if you have composed your email in HTML and going to paste the HTML source code in Body text area.

Type your detail message in the Body:

Hi,

I’m away for a week starting August 7th and will return on August 14th. In case of urgent messages, please contact my colleague Dave on 111-222-3333. Thank you and have a great week.

John

cPanel Add Auto Responder Step 2

Using Start and Stop you can set the schedule for your auto-responder. If you set Start to Immediately, the auto-responder will start working right away. You can use that to test it by sending an email from another account.

If you select Custom option, a convenient calendar pop ups to select the date for the auto-responder to start working. Similarly you can set the Stop to Never (not recommended as explained earlier) or Custom to set the end date.

Click Create/Modify to add the new auto-responder.

Auto Responder Created

And now the auto responder has been created. Click Go Back to go to the Auto Responder screen.

List of Email Auto Responders

Now you can see your newly created auto responder and can edit it or delete it.

Let us know if you face any problem or if you have any comments about the usability of this feature.

Disable Default Address (catchall) to block unwanted emails


Using this tutorial you can disable emails that are addressed to non-existent email addresses in your domain. This is also called catchall address. We strongly recommend that you do not forward them to any of your email address and never to an email address hosted outside of the server.

The reason for disabling “Default Address” is to reject spam (junk emails) addressed to random addresses on your domain. Spammers use regular persona names and common email addresses to send junk email with the hope that some of it may reach you. They can generate thousands of emails to your domain e.g. whatever@yourdomain.com, whatever123@yourdomain.com and the list goes on. This can create a denial of service attack on your email service. To avoid such attack, default address should never be used because it accepts emails for all non-existent addresses exposing your domain for email attacks. You should always create proper email accounts that you want to use. You can create any number of accounts you like as part of your Web Hosting service with no extra cost.

In addition to the above, if you forward your emails to another server or email provider (e.g. gmail.com, hotmail.com, or yahoo.com), the junk email will pass through your server as it is. This can cause your server and domain to be blamed as the source of spam for the email provider.

We assume that you have already logged into cPanel.

Default Address in cPanel

Click on Default Address under section Mail.

Block Unwanted Emails

Select the domain from the drop down for which you want to disable default address.

Select the radio button that says: Discard with error to sender (at SMTP time)

Click Change button to save the setting.

That is all. Now your domain is safe and will reject emails for email addresses that do not exist. You should do this for each domain hosted in your account.

Back to Top

© 2020 Webx Networks.