Hello,
I need help with my script that will send email via sendmail command that will shows both the header and footer logo once the recepient receive the email (e.g. MS Outlook). When I tested to ran the script it will successfully send the email BUT UNFORTUNATELY it doesn't displayed the logos as expected. What shows was there's NO logo showed up in the Header location, and the logo showed up in the Footer location was the header logo image.
Below are the scripts, thusly:
*** In my sendTest.sh ***
#!/bin/bash
DIR=/var/images
export MAILTO="junix88@gmail.com"
export SUBJECT="Test sendmail html format with logo both header and footer"
export BODY="/var/www/testcid.html"
export MAILPART=`uuidgen` # ***this will gen mailpart unique id
export MAILPART_BODY=`uuidgen` # ***this will gen mailpart_body id
export ATTACH="$DIR/headerLOGO.jpg"
export ATTACH1="$DIR/footerLOGO.jpg"
(
echo "To: $MAILTO"
echo "Subject: $SUBJECT"
echo "MIME-Version: 1.0"
echo "Content-Type: multipart/mixed; boundary=\"$MAILPART\""
echo ""
echo "--$MAILPART"
echo "Content-Type: multipart/alternative; boundary=\"$MAILPART_BODY\""
echo ""
echo "--$MAILPART_BODY"
echo "Content-Type: text/plain; charset=ISO-8859-1"
echo "You need to enable HTML option for email"
echo "--$MAILPART_BODY"
# echo "Content-Type: text/html; charset=ISO-8859-1"
echo "Content-Type: text/html; charset=UTF-8"
echo "Content-transfer-encoding: us-ascii"
echo "Content-Disposition: inline"
cat $BODY
# echo "--$MAILPART_BODY--"
echo "--$MAILPART"
echo 'Content-Type: image/jpeg; name="'$(basename $ATTACH)'"'
echo "Content-Transfer-Encoding: uuencode"
echo 'Content-Disposition: attachment; filename="'$(basename $ATTACH)'"'
echo ""
echo "--$MAILPART"
echo 'Content-Type: image/jpeg; name="'$(basename $ATTACH1)'"'
echo "Content-Transfer-Encoding: uuencode"
echo 'Content-Disposition: attachment; filename="'$(basename $ATTACH1)'"'
echo ""
(uuencode $ATTACH $(basename $ATTACH) && uuencode $ATTACH1 $(basename $ATTACH1))
echo "--$MAILPART--"
) > catout.out
cat catout.out | /usr/sbin/sendmail $MAILTO
*** In my testcid.html ***
<html>
<head>
<title>NOTIFICATION</title>
</head>
<body>
<center> <img border=1 src="cid:headerLOGO.jpg" alt=headerLogo />
<p><h4>RE: xxxxx</h4></p>
<p>abcdefghijlsfdklslslsls<br/>
asdfewrsafsdfdsfs<br/></p>
<p>Thank You.</p></td>
<p>L</p>
<center><img src="cid:footerLOGO.jpg" alt=footerLogo/></center>
</center>
</body>
</html>
I do appreciate for anyone could help me on this to figure out and correct my scripts.
Thanks in advance for your help.
Regards,
Lawrence