Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

How to mail a html file.?

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 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.?

Hi,

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
    #2  
Old Unix and Linux 01-16-2013
sathyaonnuix's Unix or Linux Image
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

Code:
echo "Content-type: text/html" > mail.html
echo "FROM: Rocky<you@gmail.com>" >> mail.html
echo "TO: recepient@gmail.com" >> mail.html
echo "SUBJECT: Test mail" >> mail.html
cat file.html >>mail.html

cat mail.html | sendmail -t

Sponsored Links
    #3  
Old Unix and Linux 01-16-2013
Skrynesaver's Unix or Linux Image
Skrynesaver Skrynesaver is offline Forum Advisor  
Grumpy old geek
 
Join Date: Mar 2011
Last Activity: 6 July 2015, 3:48 PM EDT
Location: Éire
Posts: 886
Thanks: 23
Thanked 207 Times in 203 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

Code:
Content-type: text/html;

This will tell the mail client to render the contents as html.
    #4  
Old Unix and Linux 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

Code:
 
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"
cat $CONTENT
) | /usr/sbin/sendmail $MAIL_LIST


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

Last edited by Scott; 01-16-2013 at 04:59 AM.. Reason: Please use code tags
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 06: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 06: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 03: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 09:07 PM
How do I tell mail (or pine, or whatever) that the piped in file is html? Boots Programming 1 07-16-2002 02:40 AM



All times are GMT -4. The time now is 08:18 PM.