Login to Members Area

Choose the service you want to log in
     
24x7x365 Presence
1-888-289-2246
Live Chat

Hosting Blog

 

Sending email in Linux using the "echo" command

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.

Sachin Wednesday 28 August 2013 - 9:07 pm | | Default

No comments

(optional field)
(optional field)

Comment moderation is enabled on this site. This means that your comment will not be visible until it has been approved by an editor.

Remember personal info?
Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.