If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):
From: "Brian K. White" <brian@aljex.com> References: <zwod8.2662$5o.1572023@newsr2.u-net.net> Subject: Re: command prompt SENDING MAIL Date: Sat, 23 Feb 2002 21:36:51 GMT "Stephen Younger" <StephenYounger@kingsroadtyres.co.uk> wrote in message news:zwod8.2662$5o.1572023@newsr2.u-net.net... > Hi all, > > I currently am using the following command to send print files from of > Openserver 5 > > cat invoice.rep | mail -s "Invoices for today" stephen@xx.com > > This copies the contents of the file (invoice.rep) into the message body, > but with different email packages/versions being used the formatting is > sometimes totally distorted. > > What I want to really do is attached the file or even better multiple files > to the message, so the receiver sees them as attachments. > > I know you can do this from within scomail, but I need to be able to do this > at the command prompt and it will all be done within shell scripts. > > Any help would be much appreciated. > > Best regards > > Stephen Younger
I wrote the following shell script to do this. It is somewhat less than half-baked at the moment, but as it happens, all the stuff I have not gotten around to doing to it, are pretty unneccesary, else, I'd have finished adding the features. :) basically, the idea is to take in text from any app that already prints, and send it as email, and to insure the text gets displayed in the users mail client in a fixed-width font, without trying to engage in the utterly futile and thankless hell of convincing other people to change the settings in their mail clients.... just send the mail as html and the only "html" is that the whole mail is just wrapped in <pre> </pre> so if a user does get the mail and is not using a fancy email client that understands html, very minimal harm done. in order for the mail to show up properly formatted and *not* require the user to open an attachment, the script writes it's own mail headers, so that it can include a "content-type: text/html" and it feeds the final product in to sendmail* instead of mail (*) there is a dummy "sendmail" that works with this even on sco boxes that have MMDF and not sendmail installed, don't worry about that. It actually works on both sco and linux and the only thing you have to do is change the path to sendmail in the script. usage: your-application >/tmp/textfile
reptmail H /tmp/textfile user@host.com "subject line text" requirements: unpcl and ibm2ascii scripts, found in the same place below (they also work on both sco and linux) a head.html and a tail.html which are used to dress-up the email a little more than having *just* <pre> </pre>. samples also provided below. see: http://www.aljex.com/bkw/filepro/ scroll down to "reptmail" (pronounced "report-mail", as in, it emails reports) of course it can easily just be edited to not require unpcl or head/tail html. unpcl just strips out hplaser pcl ecape codes, ibm2ascii translates ibm line-drawing characters to plain-ascii approximations. this lets 95% of the already existing reports generated from my application to be fed in without making any changes to the application. and cat head.html ... cat tail.html can be reduced to echo '<html><body><pre>' ... echo '</pre></body></html>' -- Brian K. White -- brian@aljex.com -- http://www.aljex.com/bkw/ +++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++. filePro BBx Linux SCO Prosper/FACTS AutoCAD #callahans Satriani
/Bofcusm/1477.html copyright 1997-2004 (various authors) All Rights Reserved
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar