I am trying to send an HTML email along with few attachments, but i when m not using Content-Type: text/html in header then i am able to send the attachment , but HTML part of the email is displayed as below :-
<html>
<body>
<p>This is the body content</p>
</body>
</html>
but when m using the
Content-Type: text/html in header am able to see the HTML part of the email as below :-
This is the body content
But in this case m not able to send the attachment.
Below is the 2 sets of code am using For set 1 :-
FILES="$(ls /dir_with_the_list_of_files_to_be_sent | awk '{print $0}' | tr '\n' ' ')"
(
echo "To: abc@abc.com"
echo "Subject:Extract List ";
echo "Content-Type: text/html"
echo
echo "<html>"
echo "<body>"
echo "<font face='Courier New' size='1'>"
echo "<h1>Hi All,</h1>"
echo "<h1>Below are the path </h1>"
echo "<br>"
echo "<font size="4"><p>Thanks & Regards,<br />
<br />
echo "`for f in $FILES ; do uuencode "$f" "$f" ; done `"
ABC</p></font>"
echo "</font>"
echo "</body>"
echo "</html>"
) | /usr/sbin/sendmail -t
For set 2 :-
FILES="$(ls /dir_with_the_list_of_files_to_be_sent | awk '{print $0}' | tr '\n' ' ')"
(
echo "To: abc@abc.com"
echo "Subject:Extract List ";
echo
echo "<html>"
echo "<body>"
echo "<font face='Courier New' size='1'>"
echo "<h1>Hi All,</h1>"
echo "<h1>Below are the path </h1>"
echo "<br>"
echo "<font size="4"><p>Thanks & Regards,<br />
<br />
echo "`for f in $FILES ; do uuencode "$f" "$f" ; done `"
ABC</p></font>"
echo "</font>"
echo "</body>"
echo "</html>"
) | /usr/sbin/sendmail -t
Could someone please suggest how can i send both the HTML part of email and attachment from unix.
Thanks in advance.