User Tools

Site Tools


test_mail

How to test send email in linux

Install tools :

#install mail tools
$apt-get install mailutils
#install telnet client
$apt-get install telnet

Test the connexion to the smtp server :

#telnet some_ip port
$telnet x.x.x.x 25

If you get an output, it's means the smtp respond !

Send an mail to :

$mail -s "Test Subject" address@domain.com < /dev/null

Check log (if POSTFIX) :

/var/log/mail.log


How to test send email directly connected to SMTP server IConnect to the server :

#telnet x.x.x.x 587 or 25
HELO < you start conversation
250 OK < server lets you proceed
MAIL FROM: <someuser@somedomain.com>
250 OK < server is fine with this sender
RCPT TO: <someuser@targetdomain.com>
250 OK < server is fine with recipient
DATA < you are going to send email body
250 OK < server is fine with that - proceed
Here you send your message 
. < need to close the DATA by the dot !
250 OK < server accepted message
QUIT


- created date : 2017.06.12 -

- modify date : 2019.11.15 -

test_mail.txt · Last modified: 2019/11/15 11:07 by admin