MyTrueHost launched Web Hosting for Indian clients just in Rs 60/Month with various payment options(netbanking, debit card, credit card,cash card or paypal).
Please Visit at https://www.mytruehost.in

IMAP Error (inbox.lock)

To troubleshoot the IMAP error(Inbox lock errors) while accessing mailbox via any webmail clients(Horde, SquirrelMail, NeoMail, Round Cube etc.):

The error will be shown as below,

Connection dropped by IMAP server ERROR: Connection dropped by IMAP server. Query: SELECT "INBOX" Reason Given: Unable to open this mailbox.

The error usually occurs when there is inbox.lock file in the mailbox. Here the inbox gets locked and hence the mailbox can’t be accessed and you will get the above said error.

Cause :

Exim has a exim_lock function which creates an inbox.lock file when the mails are checked once a minute or more.

Solution :

 

1. Remove the "inbox.lock" file from the particular mailbox. 

 

Eventhough the “inbox.lock” file is deleted, it will be created when the mailbox is accessed again. Hence after removing the file, we need to copy the inbox to a new file name so as to fix the issue which can be done as follows,

 

2. cat inbox > inbox.new 3. rm inbox 4. mv inbox.new inbox 5. Then fix ownership and permissions.

 

This fixes the issue.

 

Spamd failing

If you find the “spamd” failing error  on an exim restart.

root@server [~]# /etc/init.d/exim restart

Shutting down exim: [ OK ]

Shutting down antirelayd: [ OK ]

Shutting down spamd: [ FAILED ]

Starting exim-26: [ OK ]

Starting exim: [ OK ]

Starting exim-smtps: [ OK ]

Starting antirelayd: [ OK ]

Solution

When disabling “spamd”, the Cpanel create a file named “/etc/spamdisable” which may not get deleted on enabling the “spamd” feature again. Check the presence of the above said file.

The issue may also arise due to unavailability of the perl module “Mail::SpamAssassin” by installing the the same and on restarting the exim, the issue will be fixed. 

1. /scripts/perlinstaller –force Mail::SpamAssassin 

2. /etc/init.d/exim restart

 

 

 

 

 

Setting Forwarder For Outgoing Email For a Domain

To set a forwarder for all outgoing emails  from a particular domain to an email address, follow the steps given below.

Note:- This is only tested on cPanel11 Server.

1. Take the file /etc/cpanel_exim_system_filter in any of your favorite editor like pico, vim etc
2. Append the following contents to the file /etc/cpanel_exim_system_filter.

if      (
$received_protocol is “local”          or
$received_protocol is “esmtpa”         or
$received_protocol is “smtp”
) and (
$header_from contains “@domainname.com” )
then
unseen deliver username@domainname.com
endif

If you don’t want to forward emails from a  particular email address, you can append the following snippet in the /etc/cpanel_exim_system_filter.

if      (
$received_protocol is “local”          or
$received_protocol is “esmtpa”         or
$received_protocol is “smtp”
) and (
$sender_address is not “username_escape@domainname.com” )
and (
$header_from contains “@domainname.com” )
then
unseen deliver username@domainname.com
endif

3. Replace the following

domainname.com with the actual domain
username_escape@domainname.com with email address that you don’t want to forward
username@domainname.com with the email address to which you want to forward.

4. Save the file and then quit.
5. Restart Exim using the following command.

/scripts/restartsrv_exim or
/etc/init.d/exim restart

6. Test it by sending any email from the domain and then check the logs.

 

Mail Error message: Error 550 “The recipient cannot be verified”

On servers running cPanel, some times it is found that mail sent to valid users is bounced back by the mail server.

The bounce back messages will be similar to the following.

PERM_FAILURE: SMTP Error (state 9): 550-“The recipient cannot be verified.
Please check all recipients of this550 message to verify they are valid.

If the email account does indeed exist, then it is need to run the following commands to correct the issue.

/scripts/updateuserdomains
/scripts/mailperm

Also check the /etc/localdomains file and verify that the domain name is present. Also verify that the DNS line in the
/var/cpanel/user/username contains the domain as well.

 

Useful Exim Commands

Exim is a mail transfer agent used on Unix-like operating systems.  Exim is highly configurable, and therefore has features that are lacking in other MTAs. Exim  has always had substantial facilities for mail policy controls, providing facilities for the administrator to control who may send or relay mail through the system.

To print a count of the mails in the queue  -> exim -bpc

Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient) -> exim -bp

To show the current configuration file of exim -> exim -bP

To show the version and configuration file of exim -> exim -bV

Generate and display Exim stats from a logfile -> eximstats /var/log/exim_mainlog

Print what Exim is doing right now -> exiwhat

To Print the message-id of the messages in queue -> exiqgrep -i

To remove a mail from the queue -> exim -Mrm <message-id>

To freeze a mail -> exim -Mf <message-id>

To deliver a specific mail from the queue -> exim -M <message-id>

To remove all frozen mails -> exiqgrep -z -i | xargs exim -Mrm

To view the headers of a mail -> exim -Mvh <message-id>

To view body of a mail -> exim -Mvb <message-id>


The recipient cannot be verified. Please check all recipients of this 550 message to verify they are valid

If you are receiving the following error;

PERM_FAILURE: SMTP Error (state 13): 550-“The recipient cannot be verified. Please check all recipients of this
550 message to verify they are valid.”

Solution :

First you need to check the corresponding Domain name in the file ‘/etc/valiases’.

root@f ~] cat /etc/valiases/domainname
*: username@domainname

Here ‘username@domainname’ indicates an added email account.

You need to change the username only instead of  giving  ‘username@domainname’.  That is;

root@f ~] cat /etc/valiases/domainname
*: username

Here the entry username (without the domain name) indicates the default account.

Then Restart the exim mail service.

root@f ~] /etc/init.d/exim restart

How to delete frozen mails from Exim mail queue

Sometimes there can be so many frozen mails in the  Exim mail queue.

To know the number of frozen mails in the mail queue, you can use the following command

exim -bpr | grep frozen | wc -l 

In order to remove all frozen mails from the Exim mail  queue, use the following command

exim -bpr | grep frozen | awk {‘print $3’} | xargs exim -Mrm 

You can also use the command given below to delete all frozen mails

exiqgrep -z -i | xargs exim -Mrm

If you want to only delete frozen messages older than a day, you can try the following

exiqgrep -zi -o 86400

where you can change the value 86400 depending on the time frame you want to keep (1 day = 86400 seconds).

 

Exim: change the outgoing mail server IP address.

By default Exim will be using the main server IP to send mails. If the main server IP is listed in any spam database, then we will not be able to send mails. In order to fix this, we can change the Exim mail server IP to any other IP (which is not blacklisted) on the server. To do this follow the steps given below.

1. Open the Exim configuration file

  vi /etc/exim.conf

2. Locate the section of the file that contains the following:

remote_smtp:
driver = smtp


3. Replace this section with the following modified version :

remote_smtp:
driver = smtp
interface = <IP>


You need to substitute the right IP address here.

4. Restart Exim using the following commands

service exim restart
or
/etc/init.d/exim restart


This will change the outgoing mail server IP of the exim mail server.

 

Error deleting email account of deleted add-on domain

Suppose you have removed the add-on domain, say domain.com and if the email accounts still exists on the server. And when you delete the email accounts, you get the error “Account does not exist”. You can follow the steps given below to fix this issue.

1. First, delete the folders and files of that particular add-on domain. They are as follows:
/home/username/etc/domain.com
/home/username/mail/domain.com

2. Now rename the file 'email_accounts.yaml' and clear the file 'email_accounts.cache'.
These files are present in /home/user/.cpanel/:
eg:
 mv /home/user/.cpanel/email_accounts.yaml /home/user/.cpanel/email_accounts.yaml.backup
 
3. Once this is done, try to log into Cpanel once again.
You will not see the specified email accounts again.

Email Setup on iPhone

Please follow this guide to install your IMAP e-mail account:

1. Click on Settings.
2. Click on ‘Mail, Contacts, Calendars’.
3. Click on Account.
4. Click on Other

Fill the details:

Name : Your name
Address : Your email address
Password : Your account password
Description : Whatever you like here, but typically your email address or name

then, save.

5. On the ‘New Account’ screen, select IMAP (IMAP is far better than POP) and complete the details as follows:-

=> Incoming Mail Server

Host Name : Your server’s IP address or host name [ mail.kubvarunos.com]
User Name : Your email address
Password : Your account password
=> Outgoing Mail Server

Host Name : Your server’s IP address or host name again [mail.kubvarunos.com]
User Name : Your email address again
Password : Your account password again

then, save.

Once done, you should be back to the following screen showing your new email account.
6. Select the new account, then scroll down and click the ‘SMTP’ button because we want to check that it’s selected the correct SMTP port to use.
7. Click on the ‘Primary Server’ button to view the server details.
8. In almost all cases, your ‘Server Port’ should be set to 25. Please verify it.