Operating System - HP-UX
1820071 Members
2425 Online
109608 Solutions
New Discussion юеВ

Email file in MIME format via script

 
SOLVED
Go to solution

Email file in MIME format via script

I want to have a script send a file to a M$ Exchange mail server in MIME format. (My users cant deal with things like running uudecode on their side.) I know I can do this interactivly in elm, but I am looking for a way to have a script do it. There must be some way to do this.....

TIA - David
Listen to their words, but watch their feet.
6 REPLIES 6
harry d brown jr
Honored Contributor
Solution

Re: Email file in MIME format via script


for i in `echo filename1 filename2 filename3 ...`
do
uuencode $i $i.txt
done|mailx -m -s "test" username@whereever.com


and it shows up on their mail as an attachment in TEXT format.


live free or die
harry
Live Free or Die
A. Clay Stephenson
Acclaimed Contributor

Re: Email file in MIME format via script

Hi David:

You can also use elm in a non-interactive mode to send attachments.

Simply include the following syntax in your mail textfile (e.g) my_message

-----------------
This is some sample text.
[include myfile1 application/octet-stream]

This is some more stuff.

[include myfile2 application/octet-stream]

That's all folks
------------------

Then, elm -s "Sample Subject" someuser@xxx.com < my_message

The only requirement is that you must first create a .elm directory in the sender's home directory; the command-line version will not automatically create the .elm directory unlike the interactive version of elm. The above will attach myfile1 and myfile2.

If it ain't broke, I can fix that.

Re: Email file in MIME format via script

Thank you gents! I am just starting to try both of your suggestions, but I can see that I have two ways to solve my problem -- I just have to decide which one will work better at my site. That's the kind of problem I like! Thanks again.
Listen to their words, but watch their feet.
benoit Bruckert
Honored Contributor

Re: Email file in MIME format via script

Hello,
On my side, I don't use elm but a little product call "nail",
you can configure it to specify the kind of encoding with the extension of the filename.
you can download it at
http://hpux.cs.utah.edu
just a command line to send files in attachments....
Une application mal pans├йe aboutit ├а une usine ├а gaze (GHG)
Rick Beck
Occasional Advisor

Re: Email file in MIME format via script

An earlier reply mentioned using uuencode which will show up txt attachment as long as you suppress the normal mail mime headers (I believe that's the -m option on mail.

If you really need to use a MIME format instead of uuencode, you can get mpack from HPUX porting archive. I can't remember the exact URL but it is referenced in a previous reply.
Chris Vail
Honored Contributor

Re: Email file in MIME format via script

We do this with mutt (from http://www.mutt.org). Its advantage is that you can attach binaries as well as text files. The command: 'date|mutt -a somefile -h Subject ADDDRESS' attaches the file and mails it very nicely. We email instead of printing--which makes our security people happy.


Chris