The UNIX and Linux Forums  

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 to use "mail" to attach a file with an email? meili100 UNIX for Dummies Questions & Answers 2 02-23-2008 12:49 AM
How to attach a file & send mail thru script Mar1006 Shell Programming and Scripting 9 10-12-2006 05:54 AM
How to attach a file in a email ting123 UNIX for Dummies Questions & Answers 2 05-11-2006 03:14 PM
Need to attach a txt file while sending mail charan81 Shell Programming and Scripting 9 01-11-2006 10:44 PM
How to attach an excel file/ dat file thru unix mails diwakar82 Shell Programming and Scripting 1 01-06-2006 08:23 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 03-28-2001
Registered User
 

Join Date: Mar 2001
Posts: 4
Hi,

I want to know how to send a mail in unix using mailx or mail or sendmail to send a mail with a file attached. I have read the answers from the other threads but I still don't understand. I want to do it in the command line as well as in script.

Can anyone help? DO I need to use uuencode? And can I attach a htm or html file with the mail?


Firebird
Forum Sponsor
  #2  
Old 03-29-2001
mib mib is offline
Registered User
 

Join Date: Jan 2001
Location: Calicut
Posts: 228
mail -s "just to say NT carashed again" billgates@microsoft.com < mypicture.jpeg
it is not a relaible way , chances are high that the image will be unusable the time it arrives at the recipient.

another way:
(cat mailtext; uuencode mypicture.jpeg mypicture.jpeg) |
mail billgates@micro$oft.com

mailtext is provides contents for mail. The file name "mypicture.jpeg" appears twice on the uuencode command line: the first time to specify the input file name, the second time for the remote extraction file name.

but a flexible, relaible & easy way is to use <b>MetaMail</b>Package. This is the original set of MIME tools written by Nathaniel Borenstein. It works as a stand-alone set of tools for sending messages and encoding/decoding of MIME messages parts or can be set up as a plug-in for other tools. check your system before downloading metamail. new Linux distrubutions includes metamail. if you don't have try this link. after you install MetaMail Package you can use mailto or metasend. <b>metasend</b> is suitable for scripting since you could use it non-interactively.

here is an example:
metasend -b -t someone@somewhere.com -s "My webpage!" -m text/html -f mypage.html

-b batch mode (non-interactive)
-t to Recipient's address
-s subject Title (subject) of the mail message
-m MIME-type MIME content type, i.e. "text/plain", "text/html" || "application/postscript" || "image/jpeg" || "image/gif" || "video/mpeg" ....
-f filename Name of file to attach
-n Next file attachment (needed for multiple file attachments).


here is a very simple text (plain or html) attachment with just one file:
echo "From: $You\nTo: $MAILTO\nSubject: $SUBJECT\n\
Mime-Version: 1.0\nContent-Type: text/plain\n" > /tmp/file
cat MailText >> /tmp/file
/usr/lib/sendmail -t -oi < /tmp/file


above all <b>MetaMail</b> is the suitable way. isn't it?

Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:43 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0