FreeKB - Linux Commands sendmail (create send and read emails)
Linux Commands - sendmail (create send and read emails)

The sendmail command can be used to send emails. At a bare minimum, all that is needed is the recipient email address.

sendmail john.doe@example.com

 

You will then provide the sender email, recipient email, message, and a single dot to send the email.

From: no-reply@example.com
To: john.doe@example.com
This is a test
.

 

It is kind of redundent to have to include the recipient email address twice. The -t flag can be used instead.

sendmail -t

 

You will then provide the sender email, recipient email, message, and a single dot to send the email.

From: no-reply@example.com
To: john.doe@example.com
This is a test
.

 

Even better, you can store the static information in a file.

echo "From: no-reply@example.com" > foo.txt
echo "To: john.doe@example.com"  >> foo.txt
echo "Subject: Testing"          >> foo.txt
echo "Example message"           >> foo.txt

 

And then send the email by reading the file.

cat foo.txt | sendmail -t

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 0cf51 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |