LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-11-2012, 06:50 AM   #1
figure20012
Member
 
Registered: Apr 2012
Posts: 75

Rep: Reputation: Disabled
mail a html file from bash


echo "<html><body><table border=1>hello world </table></body></html>" | mail -s test user@domain.com

the result i get is
<html><body><table border=1>hello world </table></body></html>

however i want it as a file as i want it to be displayed in thunderbird

i want to send it as an attachment.Can anyone please help me?
 
Old 10-11-2012, 06:59 AM   #2
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-19-live-usb/ aix
Posts: 3,813

Rep: Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586
Code:
echo "<html><body><table border=1>hello world </table></body></html>" > attachment.html
mail -a attachment.html -s test user@domain.com
 
Old 10-11-2012, 07:04 AM   #3
figure20012
Member
 
Registered: Apr 2012
Posts: 75

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by schneidz View Post
Code:
echo "<html><body><table border=1>hello world </table></body></html>" > attachment.html
mail -a attachment.html -s test user@domain.com
thanks for helping but i need it on one line
can you please help me ?
can i use pipe?
 
Old 10-11-2012, 04:41 PM   #4
cbtshare
Member
 
Registered: Jul 2009
Posts: 561

Rep: Reputation: 42
try

Quote:
echo "<html><body><table border=1>hello world </table></body></html>" > attachment.html|mail -a attachment.html -s test user@domain.com
 
Old 10-12-2012, 12:23 AM   #5
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,225

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Quote:
but i need it on one line
why, what does it REALLY matter....?
 
Old 10-12-2012, 12:58 AM   #6
figure20012
Member
 
Registered: Apr 2012
Posts: 75

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01 View Post
why, what does it REALLY matter....?
i am putting the line in a cron
i was actually having all the output sent to mail however the mail display it in in raw html
if i have it as a file and send it as an attachment to my mail thunderbird will render the html and will give me in a better format
 
  


Reply

Tags
bash, mail, pipe


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to trigger a javascript in HTML file through a bash script? mq15 Linux - Newbie 4 04-27-2012 12:58 PM
[SOLVED] bash script to dynamically edit an html file melee Programming 24 04-17-2010 01:53 PM
How to send a html file as an file attachment to my mail from crontab? GRD Linux - Newbie 2 06-03-2008 11:39 AM
Simple parse of html file using bash ericcarlson Linux - Software 2 05-07-2008 09:44 AM
Convert an info file(bash.info.gz) to a single html file Darwish Linux - Software 2 09-24-2005 06:51 AM


All times are GMT -5. The time now is 02:07 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration