IMAPsync


Imapsync is a program to synchronise two IMAP mailboxes, mailbox trees or servers.

imapsync installation

——————

You can  install imapsync on the server using the following commands.

perl -MCPAN -e "install Test::Inter"
perl -MCPAN -e "install Parse::RecDescent"
perl -MCPAN -e "install Getopt::Long"
perl -MCPAN -e "CPAN::Shell->force(qw(install Date::Manip));"
perl -MCPAN -e "CPAN::Shell->force(qw(install Mail::IMAPClient));"
perl -MCPAN -e "CPAN::Shell->force(qw(install Term::ReadKey));"

wget http://packages.sw.be/imapsync/imapsync-1.350-1.el5.rf.noarch.rpm
rpm -i --nodeps imapsync-1.350-1.el5.rf.noarch.rpm

Syntax to use imapsync :

imapsync --host1 <Source_Server> --user1  <source_server_username> --password1 <source_server_pass> --host2 <Desination_Server> --user2   <Destination_Server_username> --password2 <Destination_Server_pass>
example :

imapsync --host1 source.com --user1  user@source.com --password1 XXXXXXX --host2 localhost --user2  user@destination.com --password2 XXXXXX
That's all...!!!

Installing and configuring Spamassassin on CentOS server


If you run your own mail server you’ll want it to run spam filtering software to reduce the number of unsolicited emails your users receive.  SpamAssassin is an effective spam filter that’s relatively easy to install and run.

Installation

—————

The first thing we will want to do is run an update on our CentOS distribution if we haven’t already.

      yum update

Once the distribution has been updated, we will want to install SpamAssassin using yum.

     yum install spamassassin

Now that we have installed SpamAssassin onto our mail server we will need to configure the SpamAssassin rules within the local.cf file to set filter preferences.

Each item of email sent to your domain is given a score by SpamAssassin.  This score depends on characteristics of the email like keywords and attachments. As with any anti-spam engine, SpamAssassin will need training to become a more accurate filter to cater to your needs.

Configuration

—————–

Let’s take a look at the default configuration for the local.cf file within SpamAssassin.  To do this we will need to open the file and make some changes.  Please use your favoured text editor; in this example we will use nano.

      nano /etc/mail/spamassassin/local.cf

We will need to uncomment the following lines and append the score:

            required_hits 5.0
            report_safe 0
            required_score 5
            rewrite_header Subject ***SPAM***

To explain what we are doing and why we are doing this, we will need a short run-down on the above lines.

Required_hits: This determines the filter balance; the lower the score the more aggressive the filter. A setting of 5.0 is generally effective for a small organisation or a single user. Adjust the strictness score to your organization’s needs – a large medical organisation might want to let email items through that are trying to sell pharmaceuticals, so we might increase the level to a more modest 8.0.

Report_safe: This line determines whether to delete the item or to move the item to the inbox whilst appending a spam notice to the subject line. The levels for this line are set to either a 1 or 0. A score of 1 will delete the spam item, whereas a score of 0 will send the item to the inbox and rewrite the subject line. For this guide we shall use 0 as the score.

Required_score: This line sets the spam score for all email alllowed through to your domain, with levels of certainty set from 0 to 5. Zero would be classified as a legitimate email item, whereas 5 would be an definite ‘SPAM’ item. If we set the score to 3 we would catch a lot of unsolicited emails but quite a few false positives would still get through. For our example email server we will use the score of 5, but you can of course set this value according to your preference.

Rewrite_header: This line does exactly what it implies, that is, any message caught as ‘SPAM’ will have the subject line rewritten to include this header. For this guide we will use the default subject header of ***SPAM***.

Now that we have the spam variables set up we will now move on to creating the spamd function.

Spamd Setup

—————

Spamd and spamc are two functions that are necessary for SpamAssassin to work correctly. Spamd is the more proactive of the two functions; it lays in wait for incoming requests, acting as a daemon to intercept and process emails. Once spamd receives a connection it will spawn a spawnc child to read the email item from the network socket. This child will pass the message back to spamd when it reaches an end of file (EOF), which will rewrite the message (if you have SpamAssassin setting the subject header for spam). This email message will then be passed back to the socket it originally arrived on using the child process it spawned at the start. The child process will then end and your regular mail server will process the message.

In briefer terms: The spamd process and its children intercept all incoming messages and process them before your regular mail server ever sees them.

Because of the nature of spamd we will need to create a unique user and group for it so we can integrate Postfix with SpamAssassin. This can be done using commands in BASH:

               groupadd spamd
               useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd
               chown spamd:spamd /var/log/spamassassin

Right, so now that we have the SpamAssasin local.cf file configured along with spamd we will need to configure the Postfix master.cf file to use the SpamAssassin scripts and the set scores we have just applied.

Postfix
We now need to access the Postfix master.cf file with a text editor.

       nano /etc/postfix/master.cf

We should now change the master.cf file to look as follows:

# ====================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ====================================================================
smtp inet n – n – – smtpd -o content_filter=spamassassin

At the bottom of this file we should add the following line:

spamassassin unix – n n – – pipe flags=R user=spamd argv=/usr/bin/spamc -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}

Before initially starting the SpamAssassin service run sa-update from a cronjob to update the spamd with the latest rules.

      sa-update && /etc/init.d/spamassassin reload

We should now start the SpamAssassin service and reload the Postfix service, to do this we can run the following commands:

        /etc/init.d/postfix reload

        /etc/init.d/spamassassin reload

To check the spam service is operating correctly we can try running a test.

The Test

———–

Create an email from an email address and service outside of your domain, e.g. Hotmail or Gmail. Address the email to an email address on the newly-configured mail server, then within the subject line we can use the following test string:

XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

Once this email has been fired off, and if all the settings have been entered correctly, we should be able to see the following message in our inbox:

****SPAM****XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

Success! We have now set up our server to use SpamassAssin to filter our inbound emails!

That’s all…!!!

sh: /usr/local/bin/sendmail-logger: No such file or directory


Issue: I got the above error while trying to send mail from a test php file after enabling mail() function on the server.

sh: /usr/local/bin/sendmail-logger: No such file or directory

Solution:

1.copy /usr/local/lib/php.ini to the user’s document root and change the ownership.

# cp  /usr/local/lib/php.ini /home/username/public_html

#chown username.username /home/username/public_html/php.ini

2.Then edit /home/username/public_html/php.ini

# vi /home/username/public_html/php.ini

Now change the php.ini as described below.

sendmail_path = “/usr/sbin/sendmail -t -i” –> enable this
;sendmail_path = /usr/local/bin/sendmail-logger—> comment this

That’s all………!!!

 

Database error: connection failed in roundcube


Issue: I got the above error while accessing round cube.

DATABASE ERROR: CONNECTION FAILED!

Unable to connect to the database!
Please contact your server-administrator

Solution:

Make sure the MySQL password of Roundcube is correct as follows:

root@server[~]$ grep db_dsnw /usr/local/cpanel/base/3rdparty/roundcube/config/db.inc.php

$rcmail_config[‘db_dsnw’] = ‘mysql://roundcube:xyz@localhost/roundcube’;

The password in this case is set in the config as: “xyz”. See if the hash matches what is set for the user:

root@server[~]$ mysql

mysql> use mysql;

mysql> select PASSWORD(‘xyz’);

mysql> select * from user where User = ’roundcube’;

mysql> update user set Password = PASSWORD(‘xyz’) where User = ’roundcube’;

If the above did not fix it, try to update. Update RoundCube.

root@server[~]$ mysqldump roundcube > /path/to/backup.sql

root@server[~]$ /usr/local/cpanel/bin/update-roundcube –force

root@server[~]$ mysql roundcube < /path/to/backup.sql

 

If this not helps please copy the roundcube backup from any of the other server with same cpanel version using scp

first create the sql backup file of /var/lib/mysql/roundcube to /root/roundcube.sql

i.e; mysqldump /var/lib/mysql/roundcube >  /root/roundcube.sql

Then copy it to your server using scp

ie : scp -r -P 2411 /root/roundcube.sql root@198.142.221.132:/root/

Where replace 198.142.221.132 with your server IP

and restore it now

root@server[~]$ mysql roundcube < /root/roundcube.sql

That’s all…….!!!!

lowest numbered MX record points to localhost


Issue: I got the above error from /var/log/exim_mainlog while sending mails from a domain hosted in my server

temporarily rejected RCPT <email@domainname.tld>: lowest numbered MX record points to local host

Solution :

Check if the domain MX is pointing to remote or not.

If the domain is using our server as MX,

The reason for the error message is the domain “domainname.tld” is missing from the /etc/localdomains file of your server. The difference between the /etc/localdomains and /etc/remotedomains  files is that, they decide whether the email has to be delivered locally OR to a remote server respectively and is checked by the exim mail server.

To fix the issue, edit the file:

# vi /etc/localdomains

and place the domain name entry there. There is no need to restart the ‘exim’ s service

Also please check if the domain is listed in /etc/remotedomains and comment the entry if it’s present there.

That’s all……!!!

cpanel Could not edit password file : Permission denied


Issue: I got this error while changing the email account’s password through cpanel.

Solution:

Check permissions of passwd file in /home/username/etc/domain.com/

The correct permissions should be the following:

-rw-r–r– 1 username mail  196 Dec  3  2005 passwd
-r–r–r– 1 username mail 1088 Dec  3  2005 passwd,v

Try to change the password now.

That’s all……!!!!

“maildir_use_size_file” option set for the second time


I got the above error while updating exim configuration manager through whm

Solution:

Delete maildir_use_size_file  from  file /usr/local/cpanel/etc/exim/matchcf/maildir_format

Please try now.

If you get the below error

“quota_is_inclusive” option set for the second time

Please remove the line quota_is_inclusive from this file /usr/local/cpanel/etc/exim/matchcf/quota_directory too.

That’s all…….!!!!

How to clear all the emails for default cPanel email account


The directories responsible for a default cPanel email account is “new” and “cur“. Both of these directories are located in /home/username/mail/

 If you need to remove all of the emails from the default email account follow the steps given below:

# cd /home/username/mail/cur
# rm -rf *
# /home/username/mail/new
# rm -rf *

If the cpanel still shows the diskspace, Please remove maildirsize” file or rename it.

That’s all……!!!!!!!

Cannot see “Disable spamassassin” button in cpanel


In your cPanel, spamassassin is enabled and you are unable to see the “Disable spamassassin” button ,do the following:

1.Login as root in your WHM.

2.Go to  Home »Service Configuration »Exim Configuration Manager

3.Now, scroll down and you will see the option: “Enable for all users without the option for users to shut off per account”

uncheck the checkbox and save.

4. Also do Forced Global ON >> off

5.Now, relogin to your cPanel account and check for spamassassin , you will find the button“Disable spamassassin”

Thats all….!!!!

Enable box trapper for cpanel accounts


Solution:

If you need to enable Box Trapper for all of the account in  a cpanel server, Please do the following steps.

1. Login to WHM

2. Go to Server Configuration –> Tweak Settings –> Mail

3. Enable BoxTrapper Spam Trap

Now please login to a cpanel account and check it in the mail section.

That’s all……!!!!!!

Previous Older Entries

Blog Stats

  • 37,404 hits