HTML file in the mailbody


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers HTML file in the mailbody
# 1  
Old 08-26-2008
HTML file in the mailbody

Hi Guys,

How can i send a html file in the mailbody. when i use the command
cat aa.html | mail -s "hello" abc.gmail.com

this displays the entire contents of the html file.

It doesn't display in html format.
# 2  
Old 08-26-2008
Quote:
Originally Posted by Swapna173
Hi Guys,

How can i send a html file in the mailbody. when i use the command
cat aa.html | mail -s "hello" abc.gmail.com

this displays the entire contents of the html file.

It doesn't display in html format.
The "mail" command will add its own headers.

Use "sendmail" instead.
# 3  
Old 08-26-2008
i think sendmail is not configured. it's says invalid command. can i use mutt command for this.
# 4  
Old 08-26-2008
Solution to sending html in email

The best thing you can do is look at the raw output of a HTML formatted eMail then emulate it.

Here's the basics of what I did
create the script web-email.sh with the content below
#!/usr/bin/sh
(
cat $1 | /usr/sbin/sendmail -t
)### end of script

Some caution should be observed because outlook has some weird behavior.

Keep in mind that you still need to define the sendmail To:, From:, Subject, etc which can not be in HTML format.

Example: aa.out has the contents below:

To: sombody@someplace.com
From: sombodyelse@someplace.com
Subject: HTML Email
Content-Transfer-Encoding: quoted-printable


--__________MIMEboundary__________
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

< the HTML YOU WANT to send in the BODY of the email goes here >

--__________MIMEboundary__________--

Last edited by dajon; 08-26-2008 at 12:42 PM.. Reason: completed example
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Copy the content from txt file and create a html file

I have a txt file with a list of error messages in a xml tag format, and each error message is separated with a identifier(endresult).Need to split that and copy and create a new html file.Error message has some special character. how to escape the special character and insert my data into the... (7 Replies)
Discussion started by: DevAakash
7 Replies

2. Shell Programming and Scripting

How to pass subject,mailbody and filename as parameters to function?

Hi Experts, how to pass subject,mailbody and filename as parameters to function. mode=$1 file=/db/files/uniq.txt mail_send() { export MAILPART=$(uuidgen) export MAILPART_BODY=$(uuidgen) { echo "TO:nalu.d@hes.com" echo "Subject:$subject" echo "MIME-Version: 1.0" ... (0 Replies)
Discussion started by: nalu
0 Replies

3. 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

4. Shell Programming and Scripting

Removing all except couple of html tags from html file

I tried to find elegant (or at least simple) way to remove all but couple of html tags from html file, but all examples I found dealt with removing all the tags. The logic of the script would be: - if there is <li> or <ul> on the line, do nothing (=write same line to output) - if there is:... (0 Replies)
Discussion started by: juubuntu
0 Replies

5. Shell Programming and Scripting

Parsing HTML, get text between 2 HTML tags

Hi there, I'm quite new to the forum and shell scripting. I want to filter out the "166.0 points". The results, that i found in google / the forum search didn't helped me :( <a href="/user/test" class="headitem menu" style="color:rgb(83,186,224);">test</a><a href="/points" class="headitem... (1 Reply)
Discussion started by: Mysthik
1 Replies

6. UNIX for Dummies Questions & Answers

Sending html email with html attachment

Hello, I have a script which is sending an html file as an attachment. #!/usr/bin/ksh export MAILTO="user@company.com" export CONTENT="/usr/tmp/file.html" export SUBJECT="EmailSubject" ( echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo "Content-Type: text/html" echo... (0 Replies)
Discussion started by: sreenathkg
0 Replies

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

8. UNIX for Advanced & Expert Users

shellinabox/html help to insert a keypress with an html button

I am trying to use shellinabox as a terminal emulator. Everything is working except there seems to be no way to simulate an F14 button press in shellinabox. I am already embedding shellinabox in an html page so Im am wondering if there is a way to make an html/js button that will pass F14 to the... (0 Replies)
Discussion started by: syadnom
0 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. UNIX for Dummies Questions & Answers

How do I extract text only from html file without HTML tag

I have a html file called myfile. If I simply put "cat myfile.html" in UNIX, it shows all the html tags like <a href=r/26><img src="http://www>. But I want to extract only text part. Same problem happens in "type" command in MS-DOS. I know you can do it by opening it in Internet Explorer,... (4 Replies)
Discussion started by: los111
4 Replies
Login or Register to Ask a Question