Operating System - HP-UX
1821051 Members
2763 Online
109631 Solutions
New Discussion юеВ

Command line script to email an attached file

 
Connie Friess
New Member

Command line script to email an attached file

I have a script that sends an email via elm but the file that is sent appears in the body of the email (elm -s TERMINATIONS xxx@marconi.com <$HOME/rctsqr/report/RCT041.TXT) Can you please tell me how to modify the above script to send the file as an attachment? Is elm what I should use or should I use mail or sendmail?
Thanks from a part-time UNIX user with no one to ask within my company!
Connie Friess
4 REPLIES 4
Dale McNamara
Frequent Advisor

Re: Command line script to email an attached file

This will send the file as an attachment

#uuencode your_file_name | sendmail -v user@mail

Mike Gordon
Occasional Advisor

Re: Command line script to email an attached file

Have a look at a utility called 'mpack'. This is an add on that packs a file in MIME format. It is available from the HP Software portal.

Uuencode works ok if the mail client is Outlook but I had problems when using Groupwise as the client.
Rick Garland
Honored Contributor

Re: Command line script to email an attached file

If a text or ASCII file, you can read it in with ~r command to mailx.
This will send as the mail message.

If you are wanting a binary, uuencode is one method. Another is the mpack.
Alan Riggs
Honored Contributor

Re: Command line script to email an attached file

Dale is correct but the syntax is:

uuencode file_name attachment_name | sendmail . . .