Problem in sending inline html with an attachment using sendmail


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem in sending inline html with an attachment using sendmail
# 1  
Old 05-31-2011
Question Problem in sending inline html with an attachment using sendmail

Code:
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=border
--border
Content-Type: text/html
Content-Disposition: inline
<html><body><h2>This text should be displayed with html formatting</h2></body></html>
--border
Content-Type: text/plain
Content-Disposition: attachment
This text should be attached
--border--

The above is the content of the file "a.txt". When the below command is executed, the mail sent has no inline text and no attachment. Please help!
Code:
cat a.txt | /usr/bin/sendmail asdf@asdf.com

# 2  
Old 06-24-2011
Try this..

Code:
echo "To: <mail-id's>" >> output_file
echo "Subject: <subject content>" >> output_file
echo "Mime-Version: 1.0" >> output_file
echo 'Content-Type: multipart/mixed; boundary="GvXjxJ+pjyke8COw"' >> output_file
echo "Content-Disposition: inline" >> output_file
echo "" >> output_file
echo "--GvXjxJ+pjyke8COw" >> output_file
echo "Content-Type: text/html" >> output_file
echo "Content-Disposition: inline" >> output_file
cat <your inline text content> >> output_file
echo "" >> output_file
echo "--GvXjxJ+pjyke8COw" >> output_file
echo "Content-Type: text/plain" >> output_file
echo "Content-Disposition: attachement; filename=<attachment file with extension>" >> output_file
echo "" >> output_file
echo "" >> output_file
cat <attachment file> >> output_file
cat output_file | /usr/lib/sendmail -t


Last edited by pludi; 06-24-2011 at 08:25 AM..
These 2 Users Gave Thanks to jayan_jay For This Post:
# 3  
Old 07-13-2011
additional info

Jayan,

Thanks for a very useful post...additional question: How can I work some body test into the reference file? Have tried a number of combinations that either break the attachment and put it inline as the body or attach the file I need, but ignore any attempts to add message body text. Is this done in Line 10 where <your inline text content> is?

Regards,

gdsmith

Last edited by gdsmith; 07-13-2011 at 11:32 AM.. Reason: additional info
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sendmail cmd for html body and attachment not working

Hi, I am having trouble in sending a mail with html body and attachment (csv file). We don't have uuencode or mutt (not allowed to install as well) The below code is perfectly working for sending the html body alone: export MAILTO=abc@xyz.com export CONTENT="/home/abc/list.html"... (2 Replies)
Discussion started by: close2jay
2 Replies

2. Shell Programming and Scripting

Need help in sending html mail with attachment

Hi Everyone, I am facing problems in sending html mail with attachemnt. I will able to send mail with attachment (plain text ) using mailx -s and uuencode command and also html mail without attachment using sendmail option. However I am not able to send html mail along with attachment.Either... (2 Replies)
Discussion started by: karthik adiga
2 Replies

3. 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

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

Sending a csv attachment and html text together.

Hello, I need to send below text (in a file ABC)as html text in mail body and the same as csv attachment 1,2,3 4,5,6 7,8,9 but to send as html text in mailbody we use echo "Subject: Report " | cat - ABC | /usr/lib/sendmail -t a@xyz.com and to send as an attachment in csv format we... (9 Replies)
Discussion started by: skhichi
9 Replies

6. UNIX for Dummies Questions & Answers

Sending html email with html attachment

Hello, I have a script which is sending an html file as an attachment. #!/usr/bin/ksh export MAILTO="user@company.com" export CONTENT="/usr/tmp/file.html" export SUBJECT="EmailSubject" ( echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo "Content-Type: text/html" echo... (0 Replies)
Discussion started by: sreenathkg
0 Replies

7. Shell Programming and Scripting

Sendmail with HTML body and attachment

I have an HTML file I am currently sending in the body of an email. I now have a need to send a csv attachment along with it. I can ONLY use sendmail as mutt and xmail etc are not on the server. Here is what I am currently using: It is possible to add code to add an attachment ??!? { ... (8 Replies)
Discussion started by: atelford
8 Replies

8. Shell Programming and Scripting

Unable to send mail with inline html along with attachment. Please help!

The below code is not working. I am able to send only inline html or only attachment. When trying to do both, only inline html is sent without attachment. Please help! #!/bin/ksh (echo "Subject: Test Mail - HTML Format" echo "MIME-Version: 1.0" echo "Content-Type: text/html" echo... (1 Reply)
Discussion started by: thulasidharan2k
1 Replies

9. Shell Programming and Scripting

Sendmail with html attachment and html body

Hi folks, I have a perl script which sends out email after successful completion of job as inline html, I want to send it out as two parts now as html inline and html attachment. see the attached script. Thanks in advance (1 Reply)
Discussion started by: sol_nov
1 Replies

10. Shell Programming and Scripting

Sending HTML attachment through mail

Hi I am new to unix and scripting.I am trying to send a html file as an attachment. SUBJECT="Type of Exceptions in Application" TO=Sushovan.Samals@gmail.com SPOOLFILE=/data/reg/tlogs/Monitor.html #echo "Send the E-mail message..." uuencode $SPOOLFILE $SPOOLFILE | mailx -s "$SUBJECT" $TO... (2 Replies)
Discussion started by: sushovan
2 Replies
Login or Register to Ask a Question