[plug] mail command
Russell Steicke
r.steicke at bom.gov.au
Sun Jun 13 09:19:15 WST 2004
On Sun, Jun 13, 2004 at 09:22:40AM +0800, Jon Miller wrote:
> I need to use the mail command at the end of a script to send
> notification that the script is completed, but along with that I need
> to send a attachment. My command so far:
>
> mail -s "${NOW}" "Backup Job is completed" "${EMAILTO}" -c
> 2nd at person.com.au
mail can't add an attachment to a message, it pre-dates attachments in
email by quite a while.
But you can do that with mutt:
mutt -x -s "${NOW} Backup Job is completed" -a file-to-attach -c 2nd at person.com.au "${EMAILTO}" < /dev/null
"< /dev/null" will stop mutt reading an email body from your terminal.
(I'm not sure why you split your subject over two args above, the mail
man page says it won't work.)
If you don't have mutt, you can try this trick:
uuencode file-to-attach remote-name-of-file | mail -s "${NOW} Backup Job is completed" -c 2nd at person.com.au "${EMAILTO}"
Some mail readers (eudora and evolution at least) will treat an inline
uuencoded file as an attachment.
> What parameter do I add to add an attachment or do I have to pipe the
> contents of the list? I hope not because the list is very long (it's
> the contents of a backup.
--
Russell Steicke
-- Fortune says:
Isn't air travel wonderful? Breakfast in London, dinner in New York,
luggage in Brazil.
More information about the plug
mailing list