How to Send Email in Linux

Following are the methods through which we can send email in linux:

Method 1: mail

# mail -s "Test Email" user@tecdistro.com < /dev/null
# mail -a /tmp/test.txt -s "Test File" user@tecdistro.com < /dev/null
# mail -s "Test Email"  user@tecdistro.com,user2@tecdistro.com < /dev/null

Method 2: mutt

# mutt -s "Test Email" user@tecdistro.com < /dev/null
# mutt  -s "Test File" -a /tmp/test.txt user@tecdistro.com < /dev/null

Method 3: sendmail

# vi /tmp/test.txt
This is a Test Email from tecdistro
# sendmail user@tecdistro.com  < /tmp/test.txt

Method 4: telnet

# telnet localhost smtp
# telnet localhost smtp
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 server.tecdistro.com ESMTP Postfix
ehlo localhost
250-server.tecdistro.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: admin@tecdistro.com
250 2.1.0 Ok
rcpt to: user@tecdistro.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
test
.
250 2.0.0 Ok: queued as 274C45A173
quit
221 2.0.0 Bye
Connection closed by foreign host.

Leave a Reply

avatar
  Subscribe  
Notify of