How do you invoke and send mail from unix ?

Questions by anandvoona

Showing Answers 1 - 7 of 7 Answers

Shyam

  • Jul 24th, 2011
 

This is how you can do mailx from the unix prompt.
Go to the path where the source file resides.
pwd> uuencode | mailx

usually in big corporations your network id is mapped to your email address.

  Was this answer useful?  Yes

The following is a more detailed example for using mailx in shell script. This should help.

Code
  1. SUBJECT="Email Subject Line"

  2. TO=xyz@company.com

  3. CC=`tr '

  4. ' ', '"xyz2@comp.com"

  5.  

  6. echo "Send the E-mail message...""${SUBJECT}""Result.txt"

  7.  

  8. ~c ${CC}

  9. ~b ${BCC}

  10.         Hi,

  11.  

  12.         Blah, Blah.. body of the email.

  13.  

  14.         Thanks

  15.         Satya

  16.         ~.

  17.         END

  18.  

  19. echo "Mail Sent!!"

  20.  


  Was this answer useful?  Yes

Mohankumar

  • Feb 14th, 2012
 

Code
  1. mailx -s "<subject>"

  Was this answer useful?  Yes

Mohit

  • Nov 17th, 2014
 

to print file as message
cat filename|mailx -s "subject" mail_id
to attach file
uuencode file_name file_name|mailx -s "subject" mail_id

  Was this answer useful?  Yes

Sanjeev

  • Apr 3rd, 2015
 

mailx -S "" << HERE
mail body
HERE
# I have used HERE document concept

  Was this answer useful?  Yes

vishnu

  • Aug 1st, 2017
 

using mutt, mailx, or uuencode

  Was this answer useful?  Yes

Shrey Shekhar

  • Sep 5th, 2020
 

cat file_name|uuencode file_name|mail -s subject line reciepent_email_address

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions