|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
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? |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to attach multiple file to send mail command | AhmedLakadkutta | Shell Programming and Scripting | 1 | 09-22-2011 05:30 PM |
| Script to attach file to mail | sfetea | Shell Programming and Scripting | 4 | 11-26-2010 07:39 AM |
| How to attach a file in Linux mail command | rohit22hamirpur | Shell Programming and Scripting | 1 | 12-05-2008 12:58 AM |
| How to attach a file & send mail thru script | Mar1006 | Shell Programming and Scripting | 9 | 10-12-2006 08:54 AM |
| Need to attach a txt file while sending mail | charan81 | Shell Programming and Scripting | 9 | 01-12-2006 12:44 AM |
|
|