Tidy up Exim Mailer hint databases

All that it takes is to run the following command

_tidydb -t 0d /var/spool/ retry

PS: /var/spool/exim is the spool directory of your exim server.

Tags: ,


Quick Hint: Clear emails from exim queue using a pattern

You might be knowing this solutions already. Here it is just for the record.

To clear Mail-Daemon failure emails from queue on an server, you can use this command.

grep -lr ‘Mailer-Daemon’ /var/spool/exim/input/ | sed -e ‘s/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g’ | xargs exim -Mrm

Tags:


421 Message temporarily deferred – Yahoo

All emails sent out to yahoo were deferring with the following error code today and I was bombarded with the tickets and chat early in the morning.

421 Message temporarily deferred – [numeric code]

If you are seeing the error “421 Message temporarily deferred – [numeric code]“, where “[numeric code]” shows a specific diagnostic code (e.g., “4.16.51″, “4.16.52″) in your SMTP logs, you will be directed to view the following page @ Yahoo.

http://help.yahoo.com/l/us/yahoo/mail/postmaster/postmaster-22.html

This doesn’t really help me to take care of the issue immediately as my customers are normally on shared hosting servers where in more than one domain will get affected as and when a big email service provider blocks our IP on their network for intentional / non-intentional spamming activities.

I have learned that such issues were used to be resolved by routing the emails to a different server to bring back the email service online or the MTA interface could have been changed to deal with the same.

Now, cpanel has made lots of changes to its MTA (exim) ACL’s to deal with this issue. Cpanel allows us to use different IP for each domain hosted on a shared hosting account if they buy a dedicated IP. These IP’s are listed in a file called /etc/mailips.  Following lines are taken from /etc/exim.conf
transport section. Here you could see that interfaces are searched against the domain name through which the email’s are being sent out of the server. If the domain name is not associated with a dedicated IP in /etc/mailips, MTA will use servers main IP to send out that email.

# This transport is used for delivering messages over SMTP connections.

begin transports

remote_smtp:
driver = smtp
interface = ${if exists {/etc/mailips}
{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{}}}{}}
helo_data = ${if exists {/etc/mailhelo}
{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}
{$primary_hostname}}}{$primary_hostname}}

dk_remote_smtp:
driver = smtp
interface = ${if exists {/etc/mailips}
{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{}}}{}}
helo_data = ${if exists {/etc/mailhelo}
{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}
{$primary_hostname}}}{$primary_hostname}}
dk_private_key = “/var/cpanel/domain_keys/private/${dk_domain}”
dk_canon = nofws
dk_selector = default

Today, I faced an issue where in a php script that was unable to send out emails to  yahoo accounts. PHP sends email as the user nobody (web server user), hence the emails needs to be sent out via server’s main IP.  Server’s main IP was found to be blocked by yahoo and I had to take care of this issue quickly as my customer was on chat. Customer had no dedicated IP allocated to his domain and I can’t help much even if he has got one as php is sending out email as nobody. I had to change the interface used for servers host name.

I went ahead and added a entry in /etc/mailips (I found it empty) and added the host name with the secondary IP which was found on the server as follows :

server.hostname.com :

To test whether this configuration works fine or not, I sent out an email to yahoo test account via console and it did a trick. Even php scripts started shooting out emails to yahoo accounts.


Cpanel is feature rich

If you’re a web hosting service provider, system administrator, website owner you got to think about a tool which lets you manage your server and websites easily. Cpanel is one of my favorite control panel for web hosting automation. Cpanel gives a lot of help to system administrator and save a considerable amount of time. Its ease of use and the fresh web2.0 design lets website owners manage their websites easily. On top of all this, Cpanel constantly improves and updates its product features. If you don’t have Cpanel on your servers think of using it, you will find the reasons below. Following gives an update on recent changes happening in Cpanel features.

cPanel 11.23 introduces a number of exciting changes to our industry leading control panel product. While there are many changes on the backend to cPanel and WHM with the 11.23 release, we’ll focus on four main areas: Memory Usage Reduction, Mail Flexibility and Efficiency, Backups and Transfers, and User Specific Changes.

Memory Usage

We aimed at reducing the memory footprint of cPanel with the 11.23 release. Two major changes in this area are VPS Optimized and Tailwatch. These changes were discussed earlier on the cPanel blog. Both of these changes are part of an overall focus in reducing memory overhead of the cPanel product, a focus that
extends beyond just our customers using VPS setups. The end result is a more responsive product that also uses less memory (up to 60% less standing memory usage on a VPS).

Mail Flexibility and Efficiency

Several important changes pertaining to mail handling and usage are available in 11.23.  cPanel 11.23 introduces full support for the Roundcube webmail interface. This provides a nice modern alternative for webmail users. Also, it is now possible to have Exim send mail using the IP address dedicated to an account. This not only brings in a much requested feature, but also resolves issues with using SPF records on
accounts with dedicated IP addresses. We have also introduced a SPF preference in the Exim Configuration editor to enable SPF checking at SMTP time. Running SPF checks at SMTP time, rather than during SpamAssassin greatly speeds up the mail delivery process on your server.

Backups and Transfers

cPanel account backup and transfer utilities have been greatly improved in cPanel 11.23. In 11.23 when transferring accounts, the utilities use WHM instead of rsync in order to improve speed and deal better with large file sizes. Also, more information about the accounts being transferred is available, such as disk space those accounts are currently using. Also the option to express transfer accounts from other cPanel servers has been added in order to speed up transfers.

User Specific Changes

In order to meet the needs of users on corporate proxies who cannot access cPanel, Webmail and WHM on the regular ports, a proxy system has been introduced to cPanel 11.23 which allows access to each service through a subdomain. For example, a user can now access cPanel at http://cpanel.example.com instead of https://example.com:2083/.

Additionally, a mechanism has been built into cPanel to notify users of SSL certificates which will expire soon. As it is highly important to ensure your SSL certificates are functioning properly, users will be alerted 30 days before their certificate is due to expire so they have ample time to renew their certificate.

Along with these changes, many products such as PHPMyAdmin which are shipped with cPanel have been upgraded to newer and far more responsive versions in order to improve the domain owner experience.

While the above features provide a great benefit to server administrators and end users, they are only a few of the changes that are brought about by cPanel 11.23. Other changes such as DNS record type support  have been documented in the cPanel change log at http://changelog.cpanel.net

If you wish to stay on cPanel 11.18, you should change your update preferences to use STABLE builds only.

Cpanel can change the future of your webhosting. Have a look at it today. If you want your websited hosted on a cpanel server, I can help you with it :) .

Isoqlog – Monitoring MailQ

Monitoring Mail server queues is always not an easy job. That too when our servers becomes victims of spammers, it takes hell a lot of job to identify the spammer and block him.

Yesterday I came across this wonderful tool called “Isoqlog“written in C. A turkey software development team at EnderUnix has developed this tool to keep and eye on qmail, postfix, sendmail and exim mail server activities by scanning their logs. This tool generates HTML statistics pages which can be accessed via your web browser. It also produces Top domains output according to Sender, Receiver, Total mails and bytes; it keeps your main domain mail statistics with regard to Days Top Domain, Top Users values for per day, per month and years.

It really made my job easier on a qmail server. Now its your turn to try it on your mail servers.Installation of this tool is very simple. Download the latest tarball from EnderUnix.org and follow the other instructions given below :

a) Downloading tar ball

# wget http://www.enderunix.org/isoqlog/isoqlog-2.2.1.tar.gz

b) untar the tar ball and get into source directory

#tar -zxvf isoqlog-2.2.1.tar.gz

#cd isolog-2.2.1

c) Now install the app (README and INSTALL files can be found in the source directory)

1. ./configure

 If you would like to use default options just type 'configure'

 To see more options type 'configure --help'2. make

 Compiling...

3. make install

 Installing...

4. make clean

 Removing objects files...

By default isoqlog is installed in /usr/local

ps: if you come across any errors, refer to the faq on the isoqlog website or comment on my post.

d) Now its time to configure:

isoqlog generates html files under your servers main document root ( /var/www/html/isoqlog). This folder required couple of folders to be copied from the source to provide the required css files and images.

#cp -r images /var/www/html/isoqlog

#cp -r library /var/www/html/isoqlog

(Please create a directory called isoqlog or run isoqlog command to get it created automatically)
Sample configuration file for isoqlog is available at /usr/local/etc copy this isoqlog.conf as follows.

#cp /usr/local/etc/isoqlog.conf-dist /usr/local/etc/isoqlog.conf

the last this required for isoqlog to start generating the logs is domain names:

I ran a piece of code to get the list of domains configured on my qmail server and added it to /usr/loca/etc/isoqlog.domains
for i in `ls /home/vpopmail/domains `; do echo $i >> /usr/local/etc/isoqlog.domains ; done

Okay, now just run

#/usr/local/bin/isoqlog

or just

#isoqlog

to start generating the logs which can be accessed via your webserver : Example: http://servername.com/isoqlog

To automate the log generation add a cron job to your crontab

# crontab -e

(the above command will open the cronjob’s file add the following line and save the file)

58 * * * * /usr/local/bin/isoqlog 1>/dev/null 2>/dev/null

this will run isoqlog every hour at 58. minute

Thanks again to the development team.

Let me know if you can get it work for your other MTA’s.

Happy MTA monitoring