Using mail/nail non-interactively
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Red Hat support > Red Hat Topics > Using mail/nail non-interactively




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Using mail/nail non-interactively  
pete


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-01-05 12:45 PM

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








[ Post a follow-up to this message ]



    Re: Using mail/nail non-interactively  
Kill Bill


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-02-05 12:45 PM

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.





[ Post a follow-up to this message ]



    Re: Using mail/nail non-interactively  
pete


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-02-05 12:45 PM

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





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:53 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register