Send a mail with an attachement of a file

I wanted to try sending a mail with an attachement at command prompt in unix. Some one please advise that how we can do it ?

Thanks, :slight_smile:

Not sure how to "attach" something, but you could try the following to add a message to an email.Using 'cat' or 'more' to redirect the contents of your attachment into a variable that is piped to mail.

(the following command specifies both a return address and the sending address. They can be different if you so choose)

echo $MAIL_MESSAGE | mailx -s "Subject" -r $RETURN_ADDY $YOUR_ADDY

If you use the search button on this site and search for attach and mail, you will find quite a few discussions on the subject such as the following