Problems using multipart/mixed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problems using multipart/mixed
# 1  
Old 09-25-2006
Problems using multipart/mixed

Hi all

I'm having trouble using MIME's multipart/mixed content type. I just try to send an email with a common body text together with an attachment (.gif). The only output I get is an empty email with no text and an invalid attachment (MS Outlook says it doesn't recognize the attachment type). Both text body and attachment show up when sent separately (i.e. not using muiltipart/mixed) which should prove my encoding is correct.

Here is the code:
Code:
#!/usr/bin/ksh 
 
echo "To: \"User\" <user@domain.com>" > mailtest 
echo "Subject: Testing attachments" >> mailtest 
echo "MIME-Version: 1.0" >> mailtest 
echo "From: \"My Test\" <bass@europolitan.se>" >> mailtest 
echo "Content-Type: multipart/mixed; boundary=\"sendfile-attachment-boundary\"" >> mailtest 
 
echo "--sendfile-attachment-boundary" >> mailtest 
echo "Content-Type: text/plain; charset=\"us-ascii\"" >> mailtest 
echo "Hello how are you?" >> mailtest 
 
echo "--sendfile-attachment-boundary" >> mailtest 
echo "Content-Type: image/gif; name=\"header_logo_trans.gif\"" >> mailtest 
echo "Content-Transfer-Encoding: base64" >> mailtest 
echo "Content-Disposition: attachment" >> mailtest 
base64-1.4/base64 -e header_logo_trans.gif >> mailtest 
echo "--sendfile-attachment-boundary--" >> mailtest 
 
cat mailtest | mail user@domain.com 
 
exit 0

Now I just wonder if anybody on this forum could easily identify the error (if there is one Smilie ). I´ve searched for hours on the internet and found some examples but it mostly tended to say my above code was correct...

Many thanks,
Yann

PS: I first searched for an answer in the FAQ and found a topic. However I didn't feel more clever having read it Smilie

Last edited by Indalecio; 09-25-2006 at 09:42 AM..
# 2  
Old 09-25-2006
Have a look at this post.
# 3  
Old 09-26-2006
Thank you for your reply!
I could finally make it work thanks to the post you refered to. I had in fact too few boundaries within my email structure.
Cheers,
Yann
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Construct and Send Multipart MIME Mail

Hi, I have requirment in shell script to incorporate multipart email with both html and text. Here am giving the text version. From: any@email.com To: your@email.com Subject: Success Execution - $company - Apps PO File Report Apps PO File Report Summary: #APPS Purchase... (2 Replies)
Discussion started by: kirankumar
2 Replies

2. Shell Programming and Scripting

> dpkg-deb to Extract and Reconstruct a Multipart Archive???

Greetings! Here's one which has been bugging me for a bit ;) As might be known, LibreOffice is available to some of us Linux folk as a large set of debs. Of course, being a curious sort, I'd like to dig in and recreate the original tree which is composed of these assorted archives. So, I... (1 Reply)
Discussion started by: LinQ
1 Replies

3. Shell Programming and Scripting

Curl Script - Post a file (multipart/form-data)

Hi All, I am trying to post an xml file (utf-16 encoded) using curl to a REST service. The REST service is expecting 'multipart/form-data' content type. curl -k -i -H "Content-Type=multipart/form-data" -F "filename=@file.xml;type=text/xml" -X POST -u <username>:<password> <endPointURL> ... (0 Replies)
Discussion started by: Anooja G
0 Replies

4. Shell Programming and Scripting

How to use FS for mixed file?

Hi! All I am just wondering solution to use FS if file fields are separated by whitespace (one or more spaces ), tab and comma, How to use FS ? finally I want to print all columns as tab separated look at my file here tagged 130, US 121337 30.530 -58.900 1941 1 25 19.50 ... (5 Replies)
Discussion started by: Akshay Hegde
5 Replies

5. Shell Programming and Scripting

mixed pattern match

I need to grep out patterns that matches the following. 1SR2kW-0003XW-8L Ie a pattern that contain 16 characters and will always be in the same pattern. 6 character, then a -, then 6 character, then a - then 2 character. I need a way to grep out like we grep out IP address. Here there are... (4 Replies)
Discussion started by: anil510
4 Replies

6. UNIX for Advanced & Expert Users

Issue in Curl to send http POST request with attachment/multipart

Hi, I am using curl to hit a url using http in solaris 10 using commandline, I want to transfer an attachment(using multipart curl -F) also as a part of the request. If anyone has used kindly help me with the syntax. I am using below command: Code: /usr/local/bin/curl -v... (1 Reply)
Discussion started by: manishmaha
1 Replies

7. HP-UX

How to attach an excel file in a multipart (mime) mail

Hello. I need to send mails from hp-ux with 2 attachments: a text file and an excel file. So I'm composing a mime file which I will pipe to sendmail utility. This works fine if the only attachment is the text file (i use cat command to attach text content). But I have problems with the format... (3 Replies)
Discussion started by: elcampio
3 Replies

8. Shell Programming and Scripting

How do I compare mixed variables?

Searched all over can't figure out how to compare variables of alpha and numeric characters. Example a script that ask user to enter a password and then ask to repeat the password. (6 Replies)
Discussion started by: monx
6 Replies

9. Shell Programming and Scripting

output only numbers from mixed string

it must be late because I'm sure this is an easy task with grep sed or awk string would be anything mixing numbers letters and ) ( = output I need is just the numbers... but I just can't seem to get it to work. Any tips would be great :) (10 Replies)
Discussion started by: nortypig
10 Replies
Login or Register to Ask a Question