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 support@gmail.com
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 support@gmail.com
Subject: test mesgsage
Cc: supp0rt24x7@gmail… Connecting to [127.0.0.1] via relay…
220 support.localhost.com ESMTP Sendmail 8.13.8/8.13.8; Sat, 19 Nov 2011 23:47:32 -0500
>>> EHLO linux7802.localhost.com
250-server.localhost.com Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
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 [127.0.0.1]
>>> QUIT
221 2.0.0 server.localhost.com closing connection

As per above logs E-mail sent to the E-mail address support@gmail.com successfully

 

Both comments and pings are currently closed.

Comments are closed.