How to mail a html file.? | Unix Linux Forums | Shell Programming and Scripting

  Go Back    

Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

How to mail a html file.?

Shell Programming and Scripting

Closed Thread    
Thread Tools Search this Thread Display Modes
Old 01-16-2013
rocky88 rocky88 is offline
Registered User
Join Date: Jan 2013
Last Activity: 6 March 2013, 7:35 AM EST
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
How to mail a html file.?


Can anyone tell me how to mail a html file in unix?

I have a HTML file which contains a table structure, and i want this table to be created in the mail body and mail it.

Does anyone have any suggestions.
Sponsored Links
Old 01-16-2013
sathyaonnuix's Avatar
sathyaonnuix sathyaonnuix is offline
Registered User
Join Date: Aug 2012
Last Activity: 26 June 2014, 12:23 PM EDT
Posts: 129
Thanks: 35
Thanked 14 Times in 13 Posts

echo "Content-type: text/html" > mail.html
echo "FROM: Rocky<>" >> mail.html
echo "TO:" >> mail.html
echo "SUBJECT: Test mail" >> mail.html
cat file.html >>mail.html

cat mail.html | sendmail -t

Sponsored Links
Old 01-16-2013
Skrynesaver's Avatar
Skrynesaver Skrynesaver is offline Forum Advisor  
Grumpy old geek
Join Date: Mar 2011
Last Activity: 26 February 2015, 5:29 PM EST
Location: Éire
Posts: 861
Thanks: 21
Thanked 201 Times in 197 Posts
MIME (Multimedia Internet Mail Extensions) allows you specify the content type of your mail.
in the headers of your mail (ie before the first new line) you could specify

Content-type: text/html;

This will tell the mail client to render the contents as html.
Old 01-16-2013
Mani Saurabh Mani Saurabh is offline
Registered User
Join Date: Jan 2013
Last Activity: 4 December 2014, 10:11 AM EST
Location: Mumbai,India
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
use this

CONTENT=<HTML File name>
export SUBJECT="Subject Line `date` ]"
echo "Subject: $SUBJECT"
echo "MIME-Version: 1.0"
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
) | /usr/sbin/sendmail $MAIL_LIST

You can use this.. just make sure that sendmail is working

Last edited by Scott; 01-16-2013 at 05:59 AM.. Reason: Please use code tags
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
problem with sending mail from txt file having HTML code via sendmail -t jassi10781 Shell Programming and Scripting 4 09-14-2012 07:36 AM
How to embed a html file in a mail sending from Linux box with uuencode or mailx? johnveslin Shell Programming and Scripting 2 09-27-2010 07:16 PM
How to send html file in a mail not as an attachment but it should display in the mail in table for mani_isha UNIX for Dummies Questions & Answers 0 03-30-2010 04:37 AM
How can I write a HTML file in UNIX and sent it as a body of a mail diwa81 Shell Programming and Scripting 0 10-13-2004 10:07 PM
How do I tell mail (or pine, or whatever) that the piped in file is html? Boots Programming 1 07-16-2002 03:40 AM

All times are GMT -4. The time now is 12:41 AM.