|
Home > Archive > Red Hat Topics > February 2005 > Using mail/nail non-interactively
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Using mail/nail non-interactively
|
|
|
| Hi,
I'm trying to use nail via a cron job to mail me some files on a daily
basis; trouble is, I can't get nail (or mail) to run non-interactively:
mail pete@example.com -s "test"
or
nail pete@example.com -s "test" -a "attachment.tar"
In both cases it hangs, waiting for the message body. Any ideas? the man
pages doesnt seem to mention this.
Cheers,
Pete
| |
| Kill Bill 2005-02-02, 7:45 am |
| pete wrote:
> Hi,
>
> I'm trying to use nail via a cron job to mail me some files on a daily
> basis; trouble is, I can't get nail (or mail) to run non-interactively:
>
> mail pete@example.com -s "test"
Yes, this line of course not complete as mail needs you to input the
message body. You can use echo, or cat, or commandline input to supply
it so that you run it in a script. For example:
echo "test email" | mail pete@example.com -s test
or
mail pete@example.com -s test <<EOF
write anything here as message body
EOF
> or
>
> nail pete@example.com -s "test" -a "attachment.tar"
As above, mail need input for message body.
I am not sure what is the difference between "mail" and "nail". For all
the versions of "mail" I used, I don't think it can take -a option for
an attachment. Maybe this is what "nail" can do?
I never use mail to send a binary file but I guess "cat" can still do
the job, or maybe some binary-to-ascii and ascii-to-binary utilities are
additionally needed.
> In both cases it hangs, waiting for the message body. Any ideas? the man
> pages doesnt seem to mention this.
In a summary, you need supply the message body in the script, even it
*is* empty.
HTH,
--
NT stands for New Technology. Windowds NT(NT4.x)/2K(NT5.0)/XP(NT5.1)
was built on NT Technology. Anyone understands what "new" means, so
everyone knows M$ Windows NT/2K/XP/Whatever is a *real* innovation.
| |
|
| Kill Bill wrote:
> pete wrote:
>
> Yes, this line of course not complete as mail needs you to input the
> message body. You can use echo, or cat, or commandline input to supply
> it so that you run it in a script. For example:
>
> echo "test email" | mail pete@example.com -s test
Cheers, that works a treat.
> I am not sure what is the difference between "mail" and "nail". For all
> the versions of "mail" I used, I don't think it can take -a option for
> an attachment. Maybe this is what "nail" can do?
Yep, the main (perhaps only) difference between mail and nail is that nail
supports MIME attachments, removing the need for convoluted shell commands
to pack attachments.
Pete
|
|
|
|
|