Sendmail with header and footer logo in HTML body


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sendmail with header and footer logo in HTML body
# 1  
Old 05-02-2013
RedHat Sendmail with header and footer logo in HTML body

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 ***

Code:
#!/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 ***
Code:
<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

Last edited by Corona688; 05-02-2013 at 12:57 PM..
# 2  
Old 05-02-2013
Quote:
Originally Posted by lawrence88
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.
Can you show us the exact raw text of the broken email you received?
# 3  
Old 05-02-2013
Hi Corona688,

Thanks for a quick reply. Below are the actual email that I received when I ran the bash script as shown:

Image

On the footer location, this image logo below should supposedly displayed, to wit:

Image

Please let me know if you need other info/logs to help me figure out my script.

Thanks once again.

Regards,

Lawrence
# 4  
Old 05-02-2013
I mean the raw email text, headers and HTML and all... not a screenshot...
# 5  
Old 05-03-2013
Hi Corona,

Good day!

Sorry just replied back.

Below is the full email headers kindly take a look.

Code:
Delivered-To: junix88@gmail.com
Received: by 10.28.180.70 with SMTP id du3csp28344vdc;
        Fri, 3 May 2013 10:44:27 -0700 (PDT)
X-Received: by 10.210.60.65 with SMTP id q50mr9658836yhd.188.1367603067278;
        Fri, 03 May 2013 10:44:27 -0700 (PDT)
Return-Path: <root@host01-thesis1.project.ad>
Received: from HOST02-THESIS1-PROJECT.AD (36.86.158-98.q9.net. [98.158.86.36])
        by mx.google.com with ESMTPS id m28si8122623yha.241.2013.05.03.10.44.26
        for <junix88@gmail.com>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Fri, 03 May 2013 10:44:27 -0700 (PDT)
Received-SPF: neutral (google.com: 98.158.86.36 is neither permitted nor denied by best guess record for domain of root@host01-thesis1.project.ad) client-ip=98.158.86.36;
Authentication-Results: mx.google.com;
       spf=neutral (google.com: 98.158.86.36 is neither permitted nor denied by best guess record for domain of root@host01-thesis1.project.ad) smtp.mail=root@host01-thesis1.project.ad
Received: from HOST02-THESIS1-PROJECT.AD (HOST02-THESIS1-PROJECT.AD [127.0.0.1])
 by HOST02-THESIS1-PROJECT.AD (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id r43HiNMW002715
 for <junix88@gmail.com>; Fri, 3 May 2013 17:44:25 GMT
Received: (from root@localhost)
 by HOST02-THESIS1-PROJECT.AD (8.14.3/8.14.3/Submit) id r43HiNf2002714
 for junix88@gmail.com; Fri, 3 May 2013 17:44:23 GMT
Date: Fri, 3 May 2013 17:44:23 GMT
From: root <root@host01-thesis1.project.ad>
Message-Id: <201305031744.r43HiNf2002714@HOST02-THESIS1-PROJECT.AD>
To: junix88@gmail.com
Subject: Test sendmail html format with logo both header and footer
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="82edbbc8-cc85-48a9-906f-89e3467b2b7c"
--82edbbc8-cc85-48a9-906f-89e3467b2b7c
Content-Type: multipart/alternative; boundary="ede42cda-1888-4160-8319-93dcb233c5db"
--ede42cda-1888-4160-8319-93dcb233c5db
Content-Type: text/html; charset=UTF-8
Content-Transfer-encoding: us-ascii
Content-Disposition: inline
<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>
--ede42cda-1888-4160-8319-93dcb233c5db
Content-Type: image/jpeg; name=headerLogo.jpg
Content-Transfer-Encoding: uuencode
Content-Disposition: attachment; filename="headerLogo.jpg"
--ede42cda-1888-4160-8319-93dcb233c5db
Content-Type: image/jpeg; name=footerLogo.jpg
Content-Transfer-Encoding: uuencode
Content-Disposition: attachment; filename="footerLogo.jpg"
begin 755 headerLogo.jpg
M_]C_X``02D9)1@`!`0$`8`!@``#_VP!#``(!`0(!`0("`@("`@("`P4#`P,#
M`P8$!`,%!P8'!P<&!P<("0L)"`@*"`<'"@T*"@L,#`P,!PD.#PT,#@L,#`S_
MVP!#`0("`@,#`P8#`P8,"`<(#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,
M#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`S_P``1"``E`H`#`2(``A$!`Q$!_\0`
M'P```04!`0$!`0$```````````$"`P0%!@<("0H+_\0`M1```@$#`P($`P4%
:
:
:
MHHH`****`"BBB@`HHHH`****`"BBB@`HHHH`****`"BBB@`HHHH`****`/_9
`
end
begin 755 footerLogo.jpg
M_]C_X``02D9)1@`!`0$`8`!@``#_VP!#``(!`0(!`0("`@("`@("`P4#`P,#
M`P8$!`,%!P8'!P<&!P<("0L)"`@*"`<'"@T*"@L,#`P,!PD.#PT,#@L,#`S_
MVP!#`0("`@,#`P8#`P8,"`<(#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,
M#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`S_P``1"`!V`7$#`2(``A$!`Q$!_\0`
:
:
:
M-/2U$)2ZEB&0OG7DTI3(V_*68E>#V(P>1S6S118#'_X0VP\H(RW<H\MX\RWD
MTC8<Y(W,Q;J`1S\N,C%7])TR/2+3R8GN'0,3F>=YG_[Z<D_K5FBF`4444`%%
M%%`!1110`4444`%%%%`!1110`4444`%%%%`!1110`4444`%%%%`!1110`444
M4`%%%%`!1110`4444`%%%%`!1110`4444`%%%%`!1110`4444`%%%%`!1110
'`4444`?_V0``
`
end
--ede42cda-1888-4160-8319-93dcb233c5db
--ede42cda-1888-4160-8319-93dcb233c5db--
--82edbbc8-cc85-48a9-906f-89e3467b2b7c--

Thanks in advance for your help.

Regards,

Junx Lawrence
# 6  
Old 05-06-2013
Hello,

I'm new to shell scripting. Anyone could help me on my unresolve issues. Do really need to make it work as expected.

Thank you.

L
# 7  
Old 05-09-2013
Hi,

Anyone tried to figured out my posted issues.

Help is very much appreciated. I'll just wait.

Thanks,
L
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. UNIX for Dummies Questions & Answers

Sendmail with HTML body and attachment code issues

Hi, I was working on getting an HTML file in the mail body along with attaching a "csv" file to the mail. Below are the 2 parts of the code. I need help with the second part where I'm sending the mail. The HTML file as an attachment is perfect without any issues and with proper formatting.... (6 Replies)
Discussion started by: aster007
6 Replies

3. Shell Programming and Scripting

Email body not formatted with html and sendmail

Hi All, I am trying to send the contents of a file as email body. I am using html email and sendmail option of unix. I am using the below piece of code for the same : #!/usr/bin/ksh export MAILTO="email@domain.com" export SUBJECT="Report" export BODY="file_directory_path/test_file.txt"... (1 Reply)
Discussion started by: rockygsd
1 Replies

4. UNIX for Advanced & Expert Users

Mutt for html body and multiple html & pdf attachments

Hi all: Been racking my brain on this for the last couple of days and what has been most frustrating is that this is the last piece I need to complete a project. There are numerous posts discussing mutt in this forum and others but I have been unable to find similar issues. Running with... (1 Reply)
Discussion started by: raggmopp
1 Replies

5. Shell Programming and Scripting

Add header and footer with record count in footer

This is my file(Target.txt) name|age|locaction abc|23|del xyz|24|mum jkl|25|kol The file should be like this 1|03252012 1|name|age|location 2|abc|23|del 2|xyz|24|mum 2|jkl|25|kol 2|kkk|26|hyd 3|4 Column 1 is row indicator for row 1 and 2, column indicator is 1,for data rows... (1 Reply)
Discussion started by: itsranjan
1 Replies

6. Shell Programming and Scripting

Header and Footer...

Hi All, I need to write a script that In my file I have to check header and footer records are available or not. If it is available I have to run the script, otherwise I should not. But current script it is checking only the data inside the script. It is avoiding to check Header and Footer... (1 Reply)
Discussion started by: suresh_target
1 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. Red Hat

Send HTML body and HTML attachment using MUTT command

Hi there.. I need a proper "mutt" command to send a mail with html body and html attachment at a time. Also if possible let me know the other commands to do this task. Please help me.. (2 Replies)
Discussion started by: vickramshetty
2 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

Inserting Header and footer

Hi All, I have several txt files i need to enter specific header and footer (both are separate) to all these files how can i do this? plz help.. Regards, Raghav (4 Replies)
Discussion started by: digitalrg
4 Replies
Login or Register to Ask a Question