The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Reading a mailbox and sending new messages to a text file rsw626 Shell Programming and Scripting 1 04-17-2008 10:35 AM
attaching the file to mail javeed7 Shell Programming and Scripting 1 04-15-2008 08:15 AM
perl/mail - inserting file text in message body thumper Shell Programming and Scripting 2 01-28-2008 11:29 AM
sending mails with attachment and also some text in mail body guptan UNIX for Advanced & Expert Users 7 05-25-2006 03:17 AM
sendmail message body buffer limit? Optimus_P UNIX for Dummies Questions & Answers 3 10-04-2001 06:13 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-24-2008
Registered User
 

Join Date: Apr 2007
Posts: 3
Attaching file and sending text in body using sendmail command!!

Hello,

I need to send with text in the body and 2 files as attachments using sendmail command.

i can send only one at a time either attachment or text in body of email.

Can any one please help me how to get that?

I will be great for any help.

Thanks,

Sparan
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-24-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,056
sendmail by itself is a very simple mail submission agent. You need to give it a properly formatted mail message, and it will accept it into the queue, end of story.

Do you want to understand MIME, or just get this job done? In the latter case, there's a bunch of old MIME tools for this called metamail, but they are not very easy to use. Other people here have reported good success with using mutt from the command line for this.

The following is just a quick demonstration of how to do it directly on the hot metal. Don't do this at home.

Code:
cat <<'HERE'
Subject: mail message
Mime-version: 1.0
Content-type: multipart/related; boundary=foooooobar

--foooooobar

Body of message goes here

--foooooobar
Content-type: image/png; filename="icon.png"
Content-transfer-encoding: base64

HERE

mimencode file1

cat <<'HERE'

--foooooobar
Content-type: application/octet-stream; filename="worm.exe"
Content-transfer-encoding: base64

HERE

mimencode file2

echo
echo '--foooooobar--'
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:02 AM.


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

Content Relevant URLs by vBSEO 3.2.0