When you are in trouble with sending/receiving e-mails from and to your server then you can investigate it using following basic commands on Linux Plesk and cPanel based server :
PLESK :
a. Check e-mail queue
root@server # /var/qmail/bin/qmail-qstat
messages in queue: 6
messages in queue but not yet preprocessed: 0
b. You can check current running e-mail logs
root@server # tail -f /usr/local/psa/var/log/maillog
c. If you want to check previous or old logs then you can open file in viewer and find respective e-mail ID or IP address or specifc string while givin / with string and press enter
root@server # less /usr/local/psa/var/log/maillog
d. Chek e-mails in e-mail queue
root@server # /var/qmail/bin/qmail-qread
2 May 2008 12:42:47 GMT #321244 3918 <test@domain.com>
remote
testing@hotmail.com
1 May 2008 12:42:47 GMT #321244 3950 <tech@domain.com>
remote
testmail@aol.com
3 May 2008 12:42:47 GMT #321244 3968 <mymail@domain.com>
remote
email@hotmail.com
4 May 2008 12:42:47 GMT #321244 3975 <email@domain.com>
remote
tech@yahoo.com
2 May 2008 12:42:47 GMT #321244 3988 <testing@domain.com>
remote
myemail@gmail.com
e. From above output you can get a message ID like #321244 in first e-mail queue with which you can find a file having e-mail
root@server # find /var/qmail/queue -iname 321244
/var/qmail/queue/remote/12/321244
/var/qmail/queue/mess/12/321244
/var/qmail/queue/info/12/321244
f. From one of the above files you can get the IP from e-mail headers
root@server # vi /var/qmail/queue/mess/12/321244
======= ======= ======= ======= ======= ======= ======= ======= ======= ======= =======
CPANEL :
a. Check e-mail queue
root@server # exim -bpc
b. You can check current running e-mail logs
root@server # tail -f /var/log/exim_mainlog
c. If you want to check previous or old logs then you can open file in viewer and find respective e-mail ID or IP address or specifc string while givin / with string and press enter
root@server # less /var/log/exim_mainlog
d. Chek e-mails in e-mail queue
root@server # exim -bp
61h 1.8K 1OEAFt-0005G2-6R <test@domain.com>
testing@hotmail.com
59h 1.8K 1OEClh-000564-BU <tech@domain.com>
testmail@aol.com
38h 12K 1OEVob-0008JE-Oc <mymail@domain.com>
email@hotmail.com
35h 1.8K 1OEZDl-0007pB-VQ <email@domain.com>
tech@yahoo.com
14h 13K 1OEsIC-0005la-P1 <testing@domain.com>
myemail@gmail.com
e. From above output you can get a message ID like '1OEAFt-0005G2-6R' in first e-mail queue with which you can find logs, body and headers of the message respectively
View Log for message
root@server # exim -Mvl 1OEAFt-0005G2-6R
View Body for message
root@server # exim -Mvb 1OEAFt-0005G2-6R
View Header for message
root@server # exim -Mvh 1OEAFt-0005G2-6R
f. You can force delivey of one message
root@server # exim -M emailID
g. You can force another queue run
root@server # exim -qf
h. You can force another queue run and attempt to flush frozen messages
root@server # exim -qff
i. You can remove message with message ID
root@server # exim -Mrm 1OEAFt-0005G2-6R