How to send email using ssh

mail – v email address
sub :  test
test text




More examples

mail -s “some subject” [email protected]

Once you execute this it will give you a blank space where you can insert the text for your e-mail.
When you finish writing the e-mail you can stop the input mode with the key combination CTRL + D.
As soon as you press CTRL + D it will ask you for Cc:. If you want to send the e-mail to more than one recepient you can use this field and add the second e-mail address.
Note: You can add more than one e-mail address in the Cc: field separated by comma.
Here is an example:

mail -s “some subject” [email protected] Some mail text Cc: [email protected],[email protected]

Sending text file as an e-mail:

It is pretty simple to send a text file to your e-mail over the mail command.
Here is example

mail -s “some subject” [email protected] < /path/to/file


Possible problems


-bash: mail: command not found

yum install mail –> No package mail available.

You should run :

yum install mailx

mail [email protected] is working now



Similar Posts:

2 comments on “How to send email using ssh

  1. I think what you published made a ton of sense.
    However, think on this, suppose you wrote a catchier post
    title? I am not saying your content is not good., however
    suppose you added a post title that makes people desire more?
    I mean How to send email using ssh – Blog | Unix is
    kinda vanilla. You could look at Yahoo’s front page and see how they create article
    titles to grab viewers to click. You might try adding
    a video or a picture or two to get readers interested about what you’ve written. Just my opinion, it might make your posts a little

Leave a Reply

Your email address will not be published. Required fields are marked *