Category: General Linux

Linux mail server commands – smtp service

Find Message from ID

find /var/qmail/queue/ -type f -iname $ID

Find Message from String

grep -ir "$STRING"  /var/qmail/queue/mess/ 

How many emails in queue

/var/qmail/bin/qmail-qstat

List emails in queue

/var/qmail/bin/qmail-qread

Install Qmail-Remove

yum install gcc gcc-c++

wget http://www.linuxmagic.com/opensource/qmail/qmail-remove/qmail-remove-0.95.tar.gz

tar -zxvf qmail-remove-0.95.tar.gz

cd qmail-remove-0.95
make
make install
cp qmail-remove /usr/bin/
mkdir /var/qmail/queue/yanked

Nice graceful way to delete the qmail queue as the other solutions can cause trouble to the queue and then service won’t start:

service qmail stop

When the servie is stopped, execute hte following commands:
find /var/qmail/queue/mess -type f -exec rm {} ;
find /var/qmail/queue/info -type f -exec rm {} ;
find /var/qmail/queue/local -type f -exec rm {} ;
find /var/qmail/queue/intd -type f -exec rm {} ;
find /var/qmail/queue/todo -type f -exec rm {} ;
find /var/qmail/queue/remote -type f -exec rm {} ;

When this is done, run the service again and check the mail queue:
service qmail start

Remove emails in queue (Remember to stop qmail before you do this service qmail stop/service qmail start)

/usr/local/sbin/qmail-remove -r -p"stringtosearch"

Yanked folder (delete when done)

/var/qmail/queue/yanked/

Delete

find /var/qmail/queue/yanked/. | xargs rm -rf

SMTP Auth log

/var/log/secure

Mail Log

/var/log/maillog

Mail Log on Plesk

/usr/local/psa/var/log/maillog

Show smtp connections:

netstat | grep smtp

Xinet conf

/etc/xinetd.conf

The Test

Connect
telnet mailserver.com 25

Handshake
EHLO mailserver.com

Identify Sender
MAIL FROM:<[email protected]>

Identify Recipient
RCPT TO:<[email protected]>

Provide Message Body
DATA
subject:subject goes here
this is my test message
sincerely,
user
.

Google

telnet aspmx.l.google.com 25
HELO aspmx.l.google.com
MAIL FROM: <[email protected]>
RCPT TO: <[email protected]>

* Check this out:
[http://kb.parallels.com/en/1711
For postfix
[http://kb.parallels.com/en/114845
[http://kb.parallels.com/766

If you want all mail to unknown local addresses to be delivered to the void, you can do this:

echo '#' > /var/qmail/alias/.qmail-default 

 

Tags:

Linux

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.