Sometimes we need to send an email from the server to test the mail delivery from the server and if we don’t have any user/domain to send the email via authentication.
In that case, we can use the “echo” command to send the email from the root to the outside domain or email id. Below is the syntax which can be used to send the email :-
—————————————————————————————————————————————————–
echo “Mail Body” | mail -s “Subject of Mail” [email protected]
——————————————————————————————————————————————————
Also, we can send email from the command line with an attachment like below :-
——————————————————————————————————————————————————–
echo “Mail Body” | mutt -a attachment.zip -s “Subject of mail” [email protected]
——————————————————————————————————————————————————–
That’s it.
]]>