Manuel Mussini wrote:
> Hi,
>
> is there a way to send an email from a bash script?
>
> I mean . I have a script that manages some jobs that need many days to
> complete (they run locally on my desktop!)! I'd like to receive some emails
> containing the status of the job! Just like CAF's endjob mails!
>
> Is it possible?
This doesn't give any control over the from: field; it's simply piped
into sendmail. It mirrors what crond and atd do.
echo -e 'Love\n\tMaria' \
| mail -s "Message for Manuel" [log in to unmask]
The following gives complete flexibility and is what I often do to send
reports. Note that I have two sections here, one sending out the headers
(including the needed blank line), one creating the actual report. This
mirrors what is often needed in practice.
(
cat <<Z
To: [log in to unmask]
From: [log in to unmask]
Subject: Message from Maria
Z
echo Thanks so much for last night
echo
echo Love
echo -e \ Maria
) 2>&1 \
| /usr/sbin/sendmail -t
--
Cheers
John
-- spambait
[log in to unmask][log in to unmask]
Please do not reply off-list