Sponsored Content
Top Forums Shell Programming and Scripting Insert an image in HTML mail sent from Shell script Post 302929910 by anji009 on Sunday 28th of December 2014 09:47:28 PM
Old 12-28-2014
Display Insert an image in HTML mail sent from Shell script

Hi Shell Experts
I am trying to insert an image into HTML email through shell script send mail, I have the email text file which included body and the images included in it in html format.
Through my Shell script, I am calling the text file and send it through email so it it sends the email with image as I required..
The mail body looks perfectly file but images are not showing in the email..

See my code below

Code:
 
#!/bin/bash
outputFile="/home/u35731/dev/mail.txt"
(
echo "From: donotreply@xyz.com"
echo "To: anji009@xyz.com"
echo "MIME-Version: 1.0"
echo "Subject: Test"
echo "Content-Type: text/html; charset=ISO-8859-15"
echo "Content-Transfer-Encoding: 7bit"
cat $outputFile
) | sendmail -t

Can you please suggest where am i doing wrong here ?

my mail.txt files is too big to paste here, but the image and mail body related information looks like below in html format

HTML Code:
</o:shapelayout></xml><![endif]--></head><body lang=EN-SG link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><div align=center><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%;background:white'><tr><td style='padding:0cm 0cm 0cm 0cm'><div align=center><table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 width=640 style='width:480.0pt;border:solid #999999 1.0pt'><tr><td colspan=3 style='border:none;padding:0cm 0cm 0cm 0cm'><div align=center><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%'><tr><td valign=top style='padding:0cm 0cm 24.0pt 0cm'><p class=MsoNormal><span style='font-family:"Arial","sans-serif";mso-fareast-language:EN-SG'><img width=640 height=147 id="Picture_x0020_6" src="cid:image004.jpg@01D01559.A83395D0" alt="cid:image001.jpg@01D01530.C57FB980"></span><span style='font-size:12.0pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></p></td></tr></table></div></td></tr><tr><td width=15 style='width:11.25pt;border:none;padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>&nbsp;</span><span style='font-size:12.0pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></p></td><td width=610 style='width:457.5pt;border:none;padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><tr><td style='padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><div align=center><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=610 style='width:457.5pt;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><tr><td valign=top style='padding:0cm 0cm 6.0pt 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p class=MsoNormal align=center style='text-align:center'><span style='font-family:"Arial","sans-serif";mso-fareast-language:EN-SG'><img width=130 height=30 id="Picture_x0020_4" src="cid:image002.png@01D00E3D.30A814A0" alt="Julius Baer"></span><span style='font-size:12.0pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></p></td></tr></table></div></td></tr><tr><td style='padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 style='-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><tr><td width=15 style='width:11.25pt;padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>&nbsp;</span><span style='font-size:12.0pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></p></td><td style='padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 style='-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><tr><td style='padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><tr><td width="50%" style='width:50.0%;padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'></td><td width="50%" style='width:50.0%;padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'></td></tr></table></td></tr><tr style='height:1.5pt'><td style='padding:0cm 0cm 18.75pt 0cm;height:1.5pt;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><div style='border:none;border-bottom:solid #EDC8A3 1.5pt;padding:0cm 0cm 0cm 0cm'><p class=MsoNormal><span style='font-size:1.5pt;font-family:"Arial","sans-serif"'>&nbsp;<o:p></o:p></span></p></div></td></tr><tr><td width=580 style='width:435.0pt;padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p class=MsoNormal align=center style='text-align:center'><b><span style='font-size:18.0pt;font-family:"Arial","sans-serif";color:#001489;text-transform:uppercase'>IPO Bond Kit<o:p></o:p></span></b></p></td></tr><tr><td width=580 style='width:435.0pt;padding:0cm 0cm 18.75pt 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p class=MsoNormal align=center style='text-align:center'><span style='font-size:18.0pt;font-family:"Arial","sans-serif";color:#001489'>Your Account has been activated<o:p></o:p></span></p></td></tr><tr><td style='padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><tr><td width="39%" style='width:39.0%;padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>&nbsp;</span><span style='font-size:12.0pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></p></td><td width="22%" style='width:22.0%;padding:0cm 0cm 30.0pt 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><div style='border:none;border-bottom:solid #EDC8A3 1.5pt;padding:0cm 0cm 0cm 0cm'><p class=MsoNormal><span style='font-size:1.5pt;font-family:"Arial","sans-serif"'>&nbsp;<o:p></o:p></span></p></div></td><td width="39%" style='width:39.0%;padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>&nbsp;</span><span style='font-size:12.0pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></p></td></tr></table></td></tr><tr><td style='padding:0cm 0cm 11.25pt 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Dear user<br><br>Your account to the IPO Bond Kit has been activated. Please click on the link below or type the following URL into your browser:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><a href="https://singapore.xyz.com/"><span style='color:#1F497D'>https://ipokit.sin.xyz.com/</span></a></span><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></p></td></tr><tr><td style='padding:0cm 0cm 6.75pt 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#001489;text-transform:uppercase'>Quick User Reference<o:p></o:p></span></b></p></td></tr><tr><td style='padding:0cm 0cm 11.25pt 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>A quick user reference guide is attached. Please feel free to contact us if anything is unclear.<o:p></o:p></span></p></td></tr><tr><td style='padding:0cm 0cm 11.25pt 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><table class=MsoNormalTable border=0 cellpadding=0 style='-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><tr style='height:21.0pt'><td width=44 style='width:33.15pt;padding:0cm 0cm 0cm 0cm;height:21.0pt;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p class=MsoNormal><a href="https://singapore.xyz.com/"><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#001489;border:none windowtext 1.0pt;padding:0cm;mso-fareast-language:EN-SG;text-decoration:none'><img border=0 width=28 height=28 id="Picture_x0020_3" src="cid:image003.png@01D00E3D.30A814A0" alt="Link Icon"></span></a><span style='font-size:12.0pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></p></td><td width=5 style='width:3.7pt;padding:0cm 0cm 0cm 0cm;height:21.0pt;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:#1F497D'>&nbsp;</span><span style='font-size:12.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p></o:p></span></p></td><td width=137 style='width:102.55pt;padding:0cm 0cm 0cm 0cm;height:21.0pt;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p style='-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;border:none windowtext 1.0pt;padding:0cm;mso-fareast-language:EN-US'><a href="https://singapore.xyz.com/" target="_blank"><span style='color:#1F497D'>IPO Bond Kit</span></a></span><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D;mso-fareast-language:EN-US'><o:p></o:p></span></p></td></tr></table></td></tr><tr><td style='padding:0cm 0cm 11.25pt 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p style='-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><span style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-language:EN-US'><br></span><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><br>Kind regards <br><br><br>Markets Applications Singapore (<span style='color:#1F497D'><a href="mailto:anji@xyz.com"><span style='color:#1F497D'>marketsappsupport.sg@xyz.com</span></a></span>)<o:p></o:p></span></p><p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Fixed Income Trading Desk Singapore (<span style='color:#1F497D'><a href="mailto:anji@xyz.com"><span style='color:#1F497D'>securities.execution@xyz.com</span></a></span>)<o:p></o:p></span></p></td></tr></table></td><td width=15 style='width:11.25pt;padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>&nbsp;</span><span style='font-size:12.0pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></p></td></tr></table></td></tr></table></td><td width=15 style='width:11.25pt;border:none;padding:0cm 0cm 0cm 0cm;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%'><p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>&nbsp;</span><span style='font-size:12.0pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></p></td></tr></table></div></td></tr></table></div><p class=MsoNormal><span lang=EN-AU style='color:#1F497D'>Regards<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-AU style='color:#1F497D'>Anji<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-AU style='color:#1F497D'><o:p>&nbsp;</o:p></span></p></div></body></html>
Thanks in advance
Anji
 

10 More Discussions You Might Find Interesting

1. AIX

Command line/Script to send E-mail with HTML body and binary attachment

I apoligize for the cross-post but I'm not getting much in the way of help in the dummies forum: I'm trying to script sending an e-mail message on an AIX 5.x server with the following requirements: 1. command line switch to specify file name containing message body in HTML format 2. command... (3 Replies)
Discussion started by: G-Man
3 Replies

2. Shell Programming and Scripting

Script to Convert HTML to MIME mail -- HELP!

Hi: I have writed a script that read a HTML file and convert this in a multipart mime fail to send in a mail. But the result isn't interpreted lika a mime file!! Somebody can see the error??? --------------------------- #! /bin/bash SB=$1 IF=$2 OF=$3 rm -f $OF.b64 ... (7 Replies)
Discussion started by: sushisan
7 Replies

3. Shell Programming and Scripting

background image not loading in newly thrown html page by shell script

I m trying to throw back html page when a file is found.While throwing back html page, the background image is not coming. I am using Apache server.Please suggest how to resolve... #!/bin/ksh echo -e "Content-type: text/html\n\n" echo "<html><head></head><body background=\"/asc/ppp.jpg\">"... (10 Replies)
Discussion started by: ravi18s
10 Replies

4. UNIX for Advanced & Expert Users

shellinabox/html help to insert a keypress with an html button

I am trying to use shellinabox as a terminal emulator. Everything is working except there seems to be no way to simulate an F14 button press in shellinabox. I am already embedding shellinabox in an html page so Im am wondering if there is a way to make an html/js button that will pass F14 to the... (0 Replies)
Discussion started by: syadnom
0 Replies

5. Shell Programming and Scripting

Send mail with rich text / HTML with image

Hi, Is it possible to send mail from my HP-Ux system with images, rich text? I would like to program in such a way that I have my company's logo(.jpg) image attached in the mail geeting triggered. I would like to send a rich text/HTML email instead of plain text mail to the recipients. Is it... (2 Replies)
Discussion started by: rythym05
2 Replies

6. UNIX for Dummies Questions & Answers

Bash script to insert data into an html table

hi, I need to create a bash shell script which picks up data from a text file and in the output file puts it into an html made table. I have to use sed and awk utilties to do this the input text file will contain data in the format: job name para1 para2 para3 para4 para4 1 ... (1 Reply)
Discussion started by: intern123
1 Replies

7. Shell Programming and Scripting

[Solved] Shell script output in HTML or with table like results and mail

Hello, Currently i have a script which will disply the results in plain text format. I want to format the result in more readable format like Making bold headings and format with colors etc. Something like html and send that content as email. Please help me how i can do that. I am using... (10 Replies)
Discussion started by: joy lobo
10 Replies

8. Shell Programming and Scripting

Script that gathers specific values from files and puts it into HTML to send e-mail

Hi All, Sorry for long topic here. So the drill goes like that, I need a script which gathers different values from different files/locations. A_CT=`cat a.dat | awk -F'|' '{print $1}' >> report.txt` B_CT=`cat b.dat | awk -F'|' '{print $3}' >> report.txt` C_CT=`cat c.dat | awk -F'|'... (4 Replies)
Discussion started by: shivakid
4 Replies

9. Shell Programming and Scripting

Embed image to the html script

hi, trying to embed an image to the html file to send out as an email. img src="data:image/jpeg;base64,$(base64 /home/test/abc.jpg but getting error as file not found after it aplies base64 on the file. (8 Replies)
Discussion started by: ATWC
8 Replies

10. Shell Programming and Scripting

A shell script for checking the last image and sending it in attachment to mail

Hello every one. I use mutt : "mpack -s "Test" /home/pi/Pictures/2018-10-05_23_10_40.jpg my_email_addres " to send me a particular picture with the name of the data+jpg in a pictures folder, but this folder I use it for a timelapse proyect with more pictures , and what I need is... (2 Replies)
Discussion started by: maxbcn
2 Replies
All times are GMT -4. The time now is 09:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy