Command to clear Exim-mail queue
exiqgrep -i | xargs exim -Mrm : It will clear all mails in the queue
exiqgrep -o 86400 -i | xargs exim -Mrm : It will clear the mails which is older than one day
--------------------------------------------
exim -bp | awk '$6~"frozen" {print $3 }' | xargs exim -Mrm
grep -lr 'nobody@' /var/spool/exim/input/ | \sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm
grep -rl 'From: Mail Delivery System' /var/spool/exim/input/ | \sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm
grep -rl 'X-Spam-Status: Yes' /var/spool/exim/input/ | \sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm
grep -rl 'Subject: Mail delivery failed' /var/spool/exim/input/ | \sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm
grep -rl 'Message rejected' /var/spool/exim/input/ | \sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm
grep -rl 'retry time not reached for any host' /var/spool/exim/input/ | \sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm
grep -lr 'Cialis' /var/spool/exim/input/ | \sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm
grep -lr 'viagra' /var/spool/exim/input/ | \sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm
grep -lr 'Pharmaceutical' /var/spool/exim/input/ | \sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm
grep -lr '***SPAM***' /var/spool/exim/input/ | \sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm
Script to check spammer in cPanel server
awk '{ if ($0 ~ "cwd" && $0 ~ "home") {print $4} }' /var/log/exim_mainlog | sort | uniq -c | sort -nk 1
Script to see all mail headers of the mails that are residing in mail queue
exim -bpru |awk '{print $3}' | xargs -n 1 -P 40 exim -v -M
Bouncing mail
telnet domain 25
Prevent the user "nobody" from sending out mail to remote addresses
Go to Main >> Server Configuration >> Tweak Settings >>
exim -bp == mailq --- The mailq is relevant as it gives your the email IDs.
exim -M emailID == force delivery of one message
exim -qf == Force another queue run
exim -qff == Force another queue run and attempt to flush frozen messages
exim -Mvl messageID == View Log for message
exim -Mvb messageID == View Body for message
exim -Mvh messageID == View Header for message
exim -Mrm messageID == ReMove message (no errors sent)
exim -Mg messageID == Give up and fail message, message bounces to sender
Block a single account from sending mail
chmod 000 /home/user/mail
chattr +ai /home/user/mail
Get message ID to a text file
exim -bpu | less > check.txt
Optimization
message_size_limit Mail attachment size limit
Build exim.conf
/scripts/buildeximconf
Add more than 2 port to exim.
For cpanel server:
You can run exim on another port by going to the 'Service Manager' in WebHost Manager and then enabling 'exim on another port' and choosing the port number.
For another servers:
Just add this first line to /etc/exim.conf and both 25 and 26 will work as smtp ports.
daemon_smtp_ports = 25 : 26 : 5432
acl_smtp_rcpt = check_recipient
acl_smtp_data = check_message
Restart exim
Reinstall Sqiurelmail, horde,webmail
==========================
Roundcube
/usr/local/cpanel/bin/update-roundcube –force
Horde:
/usr/local/cpanel/bin/update-horde –force
/scripts/fullhordereset
Squirrelmail
/usr/local/cpanel/bin/update-squirrelmail –force
How to block relay on Exim
change this line:
hostlist relay_hosts = lsearch;/etc/relayhosts : \
localhost
To:
hostlist relay_hosts = localhost
Restart Exim.
Then: vi /etc/relayhosts
Delete everything in it.
Save the file.
Yahoo block removal
http://www.rackaid.com/resources/how-to-remove-your-email-server-from-yahoos-blacklist/
Sample form mail script
<?php
$to = "testingaccount12@gmail.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>