The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Dealing with spaces in file names in a shell script same1290 Shell Programming and Scripting 5 08-12-2008 11:01 PM
File names with spaces? Is it possible? Eric_2005 Shell Programming and Scripting 5 11-15-2006 05:13 PM
Help ! How to get elm to send multiple attachments - in batch mode anarvan UNIX for Dummies Questions & Answers 1 09-14-2005 08:41 AM
Send mail with attachments automatically in a interval period Leo Felix Shell Programming and Scripting 3 02-02-2004 10:16 AM
Directory names that contain spaces and other suggestions? Shakey21 Shell Programming and Scripting 5 01-09-2002 06:29 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-04-2009
rsmorra rsmorra is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 1
Unable to use mimesender to send attachments with spaces in the file names / paths

Hello,
I found the mimesender multiple attachment emailing shell script in the FAQ of these forums, and I have been able to use it to send multiple files, but only if they don't have spaces in their file name or path.

When I attempt to send a file with spaces in it's name, enclosed within quotations such as -A "/Invoices/ABC DEF.pdf" , I get the errors:
cat: /Invoices/ABC: No such file or director,
cat: DEF.pdf: No such file or directory

Where each word in the file name, which had been separated by spaces, is being looked at as a separate file, instead of as one file.

This is odd, considereing I can run cat "/Invoices/ABC DEF.pdf", without any problem, from the command prompt.


I'm also unable use spaces in the name that the file willl be sent as. If I send it using the option -D "Real filename which the recipient will receive.txt", I get the error: uuencode: cannot open file Real : No such file or directory (error 2). This also appears to be a mimesender issue, since, if I can uuencode a file with spaces in it's name from the command prompt, as long as it's enclosed withing quotations.


Is the problem that the arrays ATTACH and DESC array elements cannot hold a quoted string? The SUBJECT variable is set the same way as the ATTACH and DESC are, yet it can hold a quoted string of words: SUBJECT=$OPTARG, ATTACH[nattach]=$OPTARG, DESC[nattach]=$OPTARG.


Emails sent directly using unix mail and uuencode can send one (non-MIME-compliant) attachment, even if the source file has spaces in it's path/name, or if the renamed file has spaces in it:
uuencode "/Invoices/ABC DEF.pdf" "ABC DEF.pdf" | mail -s "test" rsmorra@amco.ws


I thought that mimesender's problem with spaces might have been due to the quotes already surrounding the file names in the MIME header construction section of mimesender:
scribe_out 'Content-Type: '${TYPE}'; name="'${ATTACH[i]}\"
scribe_out 'Content-Disposition: attachment; filename="'${DESC[i]}\"
I imagine this could be fixed by only adding the quotes conditionally, if the ATTACH[i] and DESC[i] don't already begin and end with them.

After the code that makes the MIME header is fixed to only have one set of quotes surrounding a file name, whether or not there are with spaces in the file name, it seems that mimesender would still break apart the original file name before it sends it cat, and break up the -D "file name as sent.ext" before running it through uuencode.

Any ideas how I can prevent mimesender from breaking apart of the original "/path/and file name", and the "Send as this file name.ext" before they reach cat and uuencode? Thanks a lot.

p.s. Please see a copy of the mimesender script in the attached .txt file.

p.p.s. The actual script does not have a .txt file extension, but that was needed to attach it here. The original script can be seen at the link above. I already tried contacting it's author, and am awaiting reply.
Attached Files
File Type: txt mimesender.txt (20.3 KB, 19 views)
Closed Thread

Bookmarks

Tags
unresolved

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0