LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mail a html file from bash (http://www.linuxquestions.org/questions/linux-newbie-8/mail-a-html-file-from-bash-4175431652/)

figure20012 10-11-2012 06:50 AM

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?

schneidz 10-11-2012 06:59 AM

Code:

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


figure20012 10-11-2012 07:04 AM

Quote:

Originally Posted by schneidz (Post 4802918)
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?

cbtshare 10-11-2012 04:41 PM

try

Quote:

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

chrism01 10-12-2012 12:23 AM

Quote:

but i need it on one line
why, what does it REALLY matter....?

figure20012 10-12-2012 12:58 AM

Quote:

Originally Posted by chrism01 (Post 4803569)
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


All times are GMT -5. The time now is 09:31 AM.