jjc_mn
asked on
uuencode and cat a file to an email
I want to cat a file to the body of an email and attach a uuencoded file but it's not working in Solaris 8.
Example
uuencode file.xls attachethisfilename.xls > attachethisfilename.xls
cat /thisfilewithinthemessageb ody | mailx -s "subject line" $emailall < attachethisfilename.xls
Any sugestions?
Example
uuencode file.xls attachethisfilename.xls > attachethisfilename.xls
cat /thisfilewithinthemessageb
Any sugestions?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What does "it's not working" mean? I think I see the problem. Emails with attachments need MIME boundaries defined. Just 'cat'ing it doesn't do that. Look at the "View Source" in an email with an attachment and you can see what I'm talking about. Basic info: http://en.wikipedia.org/wiki/E-mail_attachment More technical details: http://en.wikipedia.org/wiki/MIME
It should work both the ways given by jjc_mn and gerwinjansen
Take a look
http://www.shelldorado.com/articles/mailattachments.html
In my company a lot of scripts were sending email attachments this way. But when there was an upgrade to the Exchange server, the server admins did not keep any regard for this kind of attachment and just for the common MIME encapsulation, as a result of which the email system broke. So I had to write a Perl script to make a MIME thing because mutt was not installed or any other such command line clients
If you have mutt or can get mutt, then the there is no problem
echo "email " | mail -s "subject" -a attachment email@address
Take a look
http://www.shelldorado.com/articles/mailattachments.html
In my company a lot of scripts were sending email attachments this way. But when there was an upgrade to the Exchange server, the server admins did not keep any regard for this kind of attachment and just for the common MIME encapsulation, as a result of which the email system broke. So I had to write a Perl script to make a MIME thing because mutt was not installed or any other such command line clients
If you have mutt or can get mutt, then the there is no problem
echo "email " | mail -s "subject" -a attachment email@address
I ask because the 'attachment' process should uuencode the file and create the MIME boundaries and maybe doing the uuencode first is causing the problem, not solving it.
http://en.wikipedia.org/wiki/MIME#Multipart_messages (the example should be well explaining)
In 21st century you do not need to uuencode or base64 encode because 99,9% of mail servers were upgraded in last 10 years and are 8-bit clean, and will let your mail pass without any problem. I think sendmail is only dinosaur to do 8-7 bit conversion on the fly. (odds are high it is just lying around idle on your system)
In 21st century you do not need to uuencode or base64 encode because 99,9% of mail servers were upgraded in last 10 years and are 8-bit clean, and will let your mail pass without any problem. I think sendmail is only dinosaur to do 8-7 bit conversion on the fly. (odds are high it is just lying around idle on your system)
I suggest that you look at the source of an email with an attached file, especially an image or PDF. Virtually all mail clients use the MIME format and base64 encoding to include them in an email. Images embedded in an email are done the same way. MIME boundaries are also used to separate plain text and HTML parts of a message.
Base64 is better forgotten. it wastes space in the age of 8BITMIME capable mailers (I think relevant RFC was already there in 1995 when i started in IT)
ASKER
I had to change it a little but it works great now. Thanks!.
( cat thisfilewithinthemessagebo dy; uuencode file.xls file2.xls ) | mailx -s "subject line" $emailall
( cat thisfilewithinthemessagebo