Alternatively you could just pipe your message directly to mail (or cat from file if some process has created the message for you).

On 25/10/2008, at 10:04 AM, Matthew Palmer wrote:

On Fri, Oct 24, 2008 at 03:36:58PM -0700, Steve O'Sullivan wrote:
Hello all,

Greetings from the US just before our election time. Keeping my fingers
crossed for some change around here....

On a more technical note, I am trying to use the mail command in a
bourne shell script to send out emails about our build status.

I am hoping to be able to set mail to use a period (.) as the EOT
character instead of having to manually enter Control-D (which is hard
to do when things are triggered from a script....)

I am using Macintosh Leopard (OS X 10.5.5) and have been trying to use
mail's 'set dot' option to do this, but have had no luck. If anyone
knows the syntax for this, I would be deeply obliged. Or, if anyone
knows a better way to do this entirely, I would be equally as happy.

Use a heredoc:

mail -s "Send me a mail!" [EMAIL PROTECTED] <<EOM
Here be my mail.

It is a good mail.

No dots or Ctrl-D required.
EOM

What's actually happening here is that the "<<EOM" says to the shell "read everything from the next line until you see EOM, and make it the stdin of the mail process you're starting up". The shell will take care of the messy job of opening and closing stdin, and when the stream closes mail knows it's
done.  It's effectively typing Ctrl-D for you.

- Matt
_______________________________________________
coders mailing list
coders@slug.org.au
http://lists.slug.org.au/listinfo/coders

_______________________________________________
coders mailing list
coders@slug.org.au
http://lists.slug.org.au/listinfo/coders

Reply via email to