There are of course various ways to check whether your mail server is now configured ok or not but what I found is that checking through telnet is quick and easy.
let’s check our mail server now, it may be mail.youdomain.com or localhost depending on what you are using right now, here’s the full process:
# telnet localhost smtp Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 mail.example.com ESMTP Postfix mail from: email@example.com 250 2.1.0 Ok rcpt to: firstname.lastname@example.org 250 2.1.5 Ok data 354 End data with <CR><LF>.<CR><LF> Subject: Just a test. This is test mail using telnet. . 250 2.0.0 Ok: queued as 6846838401D6 quit 221 2.0.0 Bye Connection closed by foreign host. #_
# telnet localhost smtp
We are trying connecting localhost on port 25 (smtp). It should get connected and ready to accept your next command
mail from: email@example.com
here you are specifying the sender mail id, it should be a valid mail account otherwise mail server can reject the sender address.
rcpt to: firstname.lastname@example.org
This is the recipient mail address.
then write ‘data’ and then in new line write ‘Subject: your subject’, press Enter and start writing contents of your mail. when you want to close, write a dot (.) and press Enter. message should be sent/queued in mail queue.
Check the recipient mail address, if mail server is working ok, you should get this mail there.
Other than this method where you can quickly use mail command also, like this:
# echo "This is a test mail to check mail server." | mail - s "This is test subject" email@example.com
This is a single line command but alas! we didn’t supply sender here which may trigger rejection from mail server.
You can also use mutt tool to facilitate this, if its there in your machine, like this:
# mutt -s "Test mail" firstname.lastname@example.org < message.txt
here message.txt contains mail message.