* Jonathan Wilson [Fri, Feb 16, 2001 at 03:40:39PM -0600]:
> Howdy,
> 
> I'm trying to use /bin/mail in a bash script to send me the contents of a certain 
>file.
> My problem is I can't figure out how to do the body of the message. If I do the 
>following:
> 
> #!/bin/bash
> 
> mail -s 'hi'' [EMAIL PROTECTED] <<EOF
> 
> EOF
> 
> 
> It works fine, but that's only the subject line. I don't really see anything about 
>the body in the mail man page.
> 
> So how do I include more text?
> 

Why not just feed the file you want to send into the mail command's input?

  #!/bin/bash
  mail -s "hi" [EMAIL PROTECTED] </some/file

Another way is to call sendmail directly, something like:

  #!/bin/bash
  (echo "To: wilson@claborn"; echo "Subject: hi"; cat /some/file) |sendmail -i

The -i switch tells sendmail not to interpret a dot alone on a line as an
end of data marker. I personally prefer to use sendmail in scripts
rather than the Berkeley mail program.

-- 
Johannes Eriksson
Computer Science
<[EMAIL PROTECTED]>



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to