Find the answer to your Linux question:
Results 1 to 5 of 5
Hi , I am trying to send a mail which has no body but only subject line using the mutt and mail commands but command does not execute properly. mutt ...
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Posts
    8

    Sending mail without message body

    Hi ,

    I am trying to send a mail which has no body but only subject line using the mutt and mail commands but command does not execute properly.

    mutt -s "test mail" glopes@clemson.edu

    I am able to send a mail with a body by using
    mutt -s "test mail" glopes@clemson.edu < body.txt

    Kindly help me

  2. #2
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    Try this:

    Code:
    mutt -s "test mail" glopes@clemson.edu << EOT
    EOT

  3. #3
    Just Joined!
    Join Date
    Nov 2007
    Posts
    8
    hey vsemaska ,

    thank you for your reply.
    The command works fine when executed at command line but I am using the mutt command in a script and the script gives me the followin error now

    ./try_prj2.sh: syntax error at line 40: `end of file' unexpected

    The code is given below

    #!/bin/sh

    ## The entries of syslog are stored in storelogs
    storelogs=/var/log/syslog

    badUser=student

    ## temp file
    temporary=/tmp/temp1
    echo $badUser

    #Taking the entry student and sending it to the temp file
    grep $badUser dumpFile.txt > /dev/null


    ##echo "before 1st if"

    if [ $? -eq 0 ];then

    echo $badUser > /tmp/temp1

    grep -s $badUser /var/preserve/glopes/glopes.txt > /dev/null

    if [ $? -eq 0 ];then
    echo "No mail"
    exit 2
    fi

    ## if the name does not exist then send a mail and add the name to a file
    mutt -s "test mail" glopes@clemson.edu << EOT EOT
    grep $badUser $temporary > /var/preserve/glopes.txt

    # deleting thee temporay files generated
    rm $temporary
    fi

  4. #4
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    This:

    Code:
    mutt -s "test mail" glopes@clemson.edu << EOT EOT
    should be this:

    Code:
    mutt -s "test mail" glopes@clemson.edu << EOT
    EOT
    The 2nd EOT has to be on a line of its own. The '<< EOT' means input are the lines that follow until 'EOT' is reached.

  5. #5
    Just Joined!
    Join Date
    Nov 2007
    Posts
    8
    Thank you vsemaska!

    It worked!

Posting Permissions

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