Send an E-mail from server.

Basically to send an E-mail from the Linux server shell, the mailx module is required. First install the mailx module by usiung the yum installed.

Login in to the server as a root user and follow the following steps one by one

root@server[~]# yum install mailx

Once mailx installed on the server, you cna use the following syntax to send an E-mail from the server.

root@server[~]#mail -vv E-mail address

It will ask you for the subject

root@server[~]#mail -vv
Subject: test message

Now press control+d, it will give you Cc: option. You can ignore it and press the control+d

It will send an E-mail and show you the following logs.

root@server[~]# mail -vv
Subject: test mesgsage
Cc: supp0rt24x7@gmail… Connecting to [] via relay…
220 ESMTP Sendmail 8.13.8/8.13.8; Sat, 19 Nov 2011 23:47:32 -0500
>>> EHLO Hello localhost.localdomain [], pleased to meet you
250 HELP
>>> MAIL From: SIZE=50
250 2.1.0 … Sender ok
>>> RCPT To:
>>> DATA
250 2.1.5 … Recipient ok
354 Enter mail, end with “.” on a line by itself
>>> .
250 2.0.0 pAK4lWqU025615 Message accepted for delivery
support@gmail… Sent (pAK4lWqU025615 Message accepted for delivery)
Closing connection to []
>>> QUIT
221 2.0.0 closing connection

As per above logs E-mail sent to the E-mail address successfully


Both comments and pings are currently closed.

Comments are closed.