Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2014
    Posts
    5

    Unanswered: Send the file as an email attachment using shell script

    Hi Gurus,

    I developed a shell script which will send an email to the user but i also need to attach a file in the email as attachment.I tried with the below logic but it's not even sending email when i use it. file.log is the file which is in working directory.
    Can anyone please advise on this.

    uencode $Working/file.log $Working/file.log > $combfile

    if [ $retcode -eq 0 ]; then
    echo "completed successfully"| mailx -s "completed successfully" abc@xyz.com < $combfile


    Thanks,

  2. #2
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    Use mutt.
    Code:
    mutt -a file_to_attach -s "subject blah blah" email_address <body_of_email.txt

  3. #3
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    try it like this:
    Code:
    cd $Working
    uencode file.log file.log | mailx -s "completed successfully" abc@xyz.com
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •