Attaching file and sending text in body using sendmail command!!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Attaching file and sending text in body using sendmail command!!
# 1  
Old 03-24-2008
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
# 2  
Old 03-24-2008
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--'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Message Body while sending an email

I am making use of the following code to display the results of my txt file in an email: mail -s 'Count Validation Test Comparison Results' Ronit@XYZ.com < Count_Validation_Results_`date +%m%d%Y`.txt Email Output: ----------Query 1 Count Validation Results-------- Source count is 4 Target... (7 Replies)
Discussion started by: ronitreddy
7 Replies

2. Shell Programming and Scripting

Sending attachment using sendmail command

Send_Mail() { C_Date=`date +"%m/%d/%Y"` #Subject="MMDB Load Job Status" for i in `cat $Metafile` do if then email_address=`echo $i | cut -d":" -f2` /usr/lib/sendmail "$email_address" < $Email_File fi done } this is the send mail command i am using .please let me... (1 Reply)
Discussion started by: Alok K Yadav
1 Replies

3. UNIX for Dummies Questions & Answers

Sending mail in UNIX with body and attachment(.txt) using sendmail command

Hi All, In my .ksh script, I am sending an email with body and attachment (.txt) using sendmail command. I am able to receive the attachement along with the body of the mail. But I am getting special characters along with the content in the .txt. Also the alignment is incorrect. Can you please... (7 Replies)
Discussion started by: KRR
7 Replies

4. Shell Programming and Scripting

problem with sending mail from txt file having HTML code via sendmail -t

Hi, i have the following code in shell named as test3.sh.. #!/bin/sh . /home/<user>/.profile export dt=`date "+%d%b%y"` export tim=`date "+%d%b%y %HM:%MM"` cd export WD=`pwd` SID="<sid>" export SID export ORACLE_SID=$SID export ORACLE_HOME=/oracle/$SID/102_64 export... (4 Replies)
Discussion started by: jassi10781
4 Replies

5. Shell Programming and Scripting

Attaching .csv file and sending email

I need help with writing a shell script for writing data from a table into a .csv file and send the file has email attachment. I stuck up with attaching the file to the email. Thanks, (1 Reply)
Discussion started by: Beena
1 Replies

6. UNIX for Dummies Questions & Answers

Sending email with attachment and body

Hi I want to able to attach a file to a email and send it with a body the body of the email is within the "body" file, and the attachment in "atch" if i send like below it will send the email correctly /usr/sbin/sendmail me@you.com< body And when i send the attachment alone... (3 Replies)
Discussion started by: sridanu
3 Replies

7. Shell Programming and Scripting

Not able to attach text in body of email while sending mail with attachment

Hi, We have been trying to send mail with attachment and it is going fine, but when we try to attach a text to the body of the email, we find that the mail is going fine with the body text but the attachment is not going through. We are using ksh. The command that is successfull without the... (6 Replies)
Discussion started by: jmathew99
6 Replies

8. Shell Programming and Scripting

attaching file in mail command from shell script

Hi all, Currently in shell script i am using the following command to send mail echo "Certain assets are not loaded properly. PFA the result of the DataLoad" | mail -s "Weekly DataLoad - Failure Notification !!" $MAILINGLIST I need to attach a file along with that. How should i handle this... (7 Replies)
Discussion started by: ananthi_ku
7 Replies

9. UNIX for Dummies Questions & Answers

sorting files with find command before sending to text file

i need help with my script.... i am suppose to grab files within a certain date range now i have done that already using the touch and find command (found them in other threads) touch -d "$date_start" ./tmp1 touch -d "$date_end" ./tmp2 find "$data_location" -maxdepth 1 -newer ./tmp1 !... (6 Replies)
Discussion started by: deking
6 Replies

10. UNIX for Advanced & Expert Users

sending mails with attachment and also some text in mail body

Hi, Can some one help me with the syntax of the mailx that should send an attachment and also some text in the message body together. When I am using the following syntax it is not sending the attachment but only the message body. unix2dos -ascii $REPORTFILE | uuencode $PCFILE | mailx -s... (7 Replies)
Discussion started by: guptan
7 Replies
Login or Register to Ask a Question