How to Perfom SMTP Test Command in Linux

Q. I just installed postfix on my linux virtual private server (VPS), but i am not sure how to verify the SMTP service and perform SMTP test to ensure the email delivery working fine or not ?

A. In Linux, you can send email, peform SMTP test and diagnose email errors through the TELNET linux command :

As an example :

[root@localhost ~]# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 localhost.localdomain ESMTP Postfix
helo abc.com
250 localhost.localdomain
mail from:user@scriptsmy.com
250 2.1.0 Ok
rcpt to:ehowstufff@gmail.com
250 2.1.5 Ok
data
354 End data with .
Subject: test Email From Scriptsmy.com
Hi,

This is just test email.

regards,
.
250 2.0.0 Ok: queued as A0E013CC6
quit
221 2.0.0 Bye

Type command 1 to command 7
Command 1 :

[root@localhost ~]# telnet localhost 25

Command 2 :

helo abc.com

Command 3 :

mail from:user@scriptsmy.com

Command 4 :

rcpt to:ehowstufff@gmail.com

Command 5 :

data

Command 6 :

Subject: test Email From Scriptsmy.com
Hi,

This is just test email.

regards,
.

Command 7 :

quit

Check the status in maillog

[root@localhost ~]# tail -f /var/log/maillog
Oct 18 06:01:49 localhost postfix/cleanup[20296]: A0E013CC6: message-id=<20141018060058.A0E013CC6@localhost.localdomain>
Oct 18 06:01:49 localhost postfix/qmgr[20267]: A0E013CC6: from=, size=401, nrcpt=1 (queue active)
Oct 18 06:01:50 localhost postfix/smtp[20318]: A0E013CC6: to=, relay=gmail-smtp-in.l.google.com[2607:f8b0:4003:c05::1a]:25, delay=76, delays=75/0.01/0.12/1.3, dsn=2.0.0, status=sent (250 2.0.0 OK 1413612110 yv8si3312807oeb.10 - gsmtp)
Oct 18 06:01:50 localhost postfix/qmgr[20267]: A0E013CC6: removed
Oct 18 06:01:53 localhost postfix/smtpd[20293]: disconnect from localhost[::1]

How to Install Sendmail Service on CentOS 6.5

This post will show how to install sendmail smtp service on CentOS 6.5. By default only postfix smtp service included in CentOS 6.5. Due to some reasons you will to run sendmail service instead of postfix. But the purpose of both services still the same providing SMTP email transport service and running as an email relay on your linux system.

1. Install sendmail :

[root@centos6.5 ~]# yum install sendmail -y
..
..
..
..
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package sendmail.x86_64 0:8.14.4-8.el6 will be installed
--> Processing Dependency: procmail for package: sendmail-8.14.4-8.el6.x86_64
--> Processing Dependency: libhesiod.so.0()(64bit) for package: sendmail-8.14.4-8.el6.x86_64
--> Running transaction check
---> Package hesiod.x86_64 0:3.1.0-19.el6 will be installed
---> Package procmail.x86_64 0:3.22-25.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                Arch                 Version                       Repository          Size
====================================================================================================
Installing:
 sendmail               x86_64               8.14.4-8.el6                  base               717 k
Installing for dependencies:
 hesiod                 x86_64               3.1.0-19.el6                  base                20 k
 procmail               x86_64               3.22-25.1.el6                 base               163 k

Transaction Summary
====================================================================================================
Install       3 Package(s)

Total download size: 900 k
Installed size: 1.9 M
Downloading Packages:
(1/3): hesiod-3.1.0-19.el6.x86_64.rpm                                        |  20 kB     00:00
(2/3): procmail-3.22-25.1.el6.x86_64.rpm                                     | 163 kB     00:00
(3/3): sendmail-8.14.4-8.el6.x86_64.rpm                                      | 717 kB     00:06
----------------------------------------------------------------------------------------------------
Total                                                               117 kB/s | 900 kB     00:07
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : procmail-3.22-25.1.el6.x86_64                                                    1/3
  Installing : hesiod-3.1.0-19.el6.x86_64                                                       2/3
  Installing : sendmail-8.14.4-8.el6.x86_64                                                     3/3
  Verifying  : hesiod-3.1.0-19.el6.x86_64                                                       1/3
  Verifying  : procmail-3.22-25.1.el6.x86_64                                                    2/3
  Verifying  : sendmail-8.14.4-8.el6.x86_64                                                     3/3

Installed:
  sendmail.x86_64 0:8.14.4-8.el6

Dependency Installed:
  hesiod.x86_64 0:3.1.0-19.el6                    procmail.x86_64 0:3.22-25.1.el6

Complete!

2. Start Sendmail service :

[root@centos6.5 ~]# service sendmail start
Starting sendmail:                                         [  OK  ]
Starting sm-client:                                        [  OK  ]

3. Test sendmail respond on port 25 :

[root@centos6.5 ~]# telnet localhost 25
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 centos6.5.ehowstuff.local ESMTP Sendmail 8.14.4/8.14.4; Sun, 10 Aug 2014 20:48:52 +0800

How to Setup Postfix on CentOS 6.4

Posfix MailPostfix is a open-source mail transfer agent (MTA) that routes and delivers electronic mail. Postfix is an alternative for Sendmail service which provide the same function. This post will describe on how you can install and setup postfix on CentOS 6.4. After you installed postfix, you can use postfix command to controls the operation of the Postfix mail system such as start or stop the master daemon, do a health check, and other maintenance.

1. To install Postfix, use the following yum command :

[root@centos64 ~]# yum install postfix -y

2. To verify if Postfix is already installed, use the following rpm command :

[root@centos64 ~]# rpm -q postfix

Example :

[root@centos64 ~]# rpm -q postfix
postfix-2.6.6-2.2.el6_1.x86_64

3. How to check Postfix version :

[root@centos64 ~]# postconf -d | grep mail_version

Example :

[root@centos64 ~]# postconf -d | grep mail_version
mail_version = 2.6.6
milter_macro_v = $mail_name $mail_version

4. Configure Basic postfix main.cf file :

[root@centos64 ~]# vi /etc/postfix/main.cf

Uncomment and modify the following two line :

myhostname = centos6.4.ehowstuff.local
mydomain = ehowstuff.local

myhostname: is the host name of the system (i.e, the system is called mail or mail.example.com).
mydomain: is the domain name for the email server (it can be a real or fake domain name).

5. Start the postfix service :

[root@centos64 ~]# service postfix start
Starting postfix:                                          [  OK  ]

6. Restart the postfix service :

[root@centos64 ~]# service postfix restart
Shutting down postfix:                                     [  OK  ]
Starting postfix:                                          [  OK  ]

7. How to show postfix pid number on running for postfix services ?

[root@centos64 ~]# ps -ef | grep postfix
root      3081     1  0 05:57 ?        00:00:00 /usr/libexec/postfix/master
postfix   3083  3081  0 05:57 ?        00:00:00 pickup -l -t fifo -u
postfix   3084  3081  0 05:57 ?        00:00:00 qmgr -l -t fifo -u
root      3292  1963  0 06:40 pts/0    00:00:00 grep postfix

How to Enable IMAP on Gmail account

Gmail is one of the best free webmail service. It’s also possible to access Gmail inbox using IMAP and POP. If proper configured, you will be able to retrieve your Gmail messages with a client like Mozilla Thunderbird and Microsoft Outlook. This post will shows you the steps to enable IMAP in Gmail account :
Gmail

Steps to enable IMAP on Gmail account:

1. Sign in to your Gmail account.
2. Click on the gear icon in the upper right, then select Settings. This will bring you to configuration screen.
3. Click Forwarding and POP/IMAP.
4. By default IMAP is not enabled. Select Enable IMAP.
5. Configure your IMAP client and click Save Changes.

  • You can configure what is the next action when I mark a message in IMAP as deleted.
  • You also can configure what is the next action when a message is marked as deleted and expunged from the last visible IMAP folder.

6. Follow the “Configuration instructions” to configure your mail client such as Mozilla Thunderbird, Android and iPhone.

You can use the following information to configure IMAP with many mail clients :

Incoming Mail (IMAP) Server – requires SSL:

imap.gmail.com
Use SSL: Yes
Port: 993

Outgoing Mail (SMTP) Server – requires TLS :

smtp.gmail.com (use authentication)
Use Authentication: Yes
Use STARTTLS: Yes (some clients call this SSL)
Port: 465 or 587