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
How do I extract text only from html file without HTML tag los111 UNIX for Dummies Questions & Answers 4 11-28-2007 04:40 AM
AIX send mail with HTML message body and a binary attachment G-Man UNIX for Dummies Questions & Answers 4 03-22-2007 02:15 PM
Send an attachment and html text both in the same mail stefan.yu Shell Programming and Scripting 4 10-26-2006 09:46 PM
html - text file question frustrated1 Shell Programming and Scripting 5 09-21-2005 05:23 AM
linking unix generated text file to html page alexd Shell Programming and Scripting 1 11-13-2002 12:21 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-11-2007
Felix2511 Felix2511 is offline
Registered User
  
 

Join Date: May 2007
Location: Madrid,Spain
Posts: 20
HTML message with attachment (text-file)

Hello:

I've searched de forum but could not find an answer to send an email via sendmail in HTML with an text-file (plain-text) as attachment:

My code:

export FROM="Me"
export MAILTO="mymail"
export SUBJECT=$TITULO$bbdd
export BODY=$LOG
(
echo "FROM:$FROM"
echo "To: $MAILTO"
echo "Subject: $SUBJECT"
echo "MIME-Version: 1.0"
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
cat $BODY
) | /usr/sbin/sendmail $MAILTO

How could I include the desired attachment?

Thank you very much in advance for your help and sorry if this question has been already posted.
Félix
  #2 (permalink)  
Old 09-11-2007
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,407
Similar post : http://www.unix.com/aix/36448-comman...ttachment.html
  #3 (permalink)  
Old 09-12-2007
Felix2511 Felix2511 is offline
Registered User
  
 

Join Date: May 2007
Location: Madrid,Spain
Posts: 20
Thanks Ygor but it doesn't work.
I tried out the following:
LOG=path/test_1.txt

export FROM="Me"
export MAILTO="adress@blablabla.com"
export SUBJECT="Test"
export BODY=$LOG
export ATTACH="path/test.txt"
(
echo "To: $MAILTO"
echo "Subject: $SUBJECT"
echo "MIME-Version: 1.0"
echo 'Content-Type: multipart/mixed; boundary="-q1w2e3r4t5"'
echo
echo '---q1w2e3r4t5'
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
cat $BODY
echo '---q1w2e3r4t5'
echo 'Content-Type: application; name="'$(basename $ATTACH)'"'
echo "Content-Transfer-Encoding: base64"
echo 'Content-Disposition: attachment; filename="'$(basename $ATTACH)'"'
uuencode -m $ATTACH $(basename $ATTACH)
echo '---q1w2e3r4t5--'
) | /usr/sbin/sendmail $MAILTO

It doesn't attach the file but inlcudes it in the mail. It isn't necesary for me to include the file in binary. Any hint? Thank you.
Closed Thread

Bookmarks

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 04:42 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