How to use HTML in UNIX Bash Scripting?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How to use HTML in UNIX Bash Scripting?
# 1  
Old 05-29-2014
How to use HTML in UNIX Bash Scripting?

I am planning to run an automation , Could anyone try to help me to how to write an html in unix scripting so when I try to send email it should work especially with Bold and colors
# 2  
Old 05-29-2014
Welcome to forums,

This is one way

Code:
$ echo "<html><b>This is bold</b></html>" | mail -a "Content-type: text/html;" -s "Testing" user@domain.com

This User Gave Thanks to Akshay Hegde For This Post:
# 3  
Old 05-29-2014
can you tell me how to wite one by one
and in colors say for red color
# 4  
Old 05-29-2014
You can use font color attribute or style even,
example :

Code:
<p><font color="red">this is red</font></p>

Code:
<p style='color:red;'>This is red</p>

if you are new to html, you may go through some tutorial from here
# 5  
Old 05-29-2014
But anyways I do not get all these in email my email is blank:
# 6  
Old 05-29-2014
Okay try this script

Code:
$ cat email_content.html
<html><b>This is bold</b></html>

Code:
# !/bin/sh  
  
  
from='from@domain.com'  
to='to@domain.com'  
  
email_content='/absolute/path/to/email_content.html'  
email_subject='Your subject goes here'  
  
  
function send_email(){  
    email_date=$(date "+%Y-%m-%d_%H:%M:%S")  
    echo $email_date  
  
    email_subject=$email_subject"__"$email_date  
    echo $email_subject  
  
    cat $email_content | formail -I "From: $from" -I "MIME-Version:1.0" -I "Content-type:text/html;charset=gb2312" -I "Subject: $email_subject" | /usr/sbin/sendmail -oi $to  
  
}  
  
send_email

# 7  
Old 06-03-2014
when I try to send to many DLs it is not working:<
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issues with awk scripting for HTML tags

Below is the data file(results) contents- 13450708,13470474,US,15 24954,24845,JPN,44 14258992,14365059,US,4 24954,24845,IND,44 I want to send above data sets to email in a tabular format. For that I am using below awk script. Now the challenge I am facing here is - I want to make the... (2 Replies)
Discussion started by: Roseline
2 Replies

2. UNIX for Advanced & Expert Users

Do we have any bulletins for HTML in UNIX scripting

I have tried only 4 types of bulletins in Html using unix circle, square,disc,li Do we have any other than these in unix? (2 Replies)
Discussion started by: cassia
2 Replies

3. Shell Programming and Scripting

Having problem with how to use HTML in Unix shell scripting

Hi All, I'm new to this forum. This is my first question. I'm trying to automate the status related information in our environment. So this is how the output would be. SEGMENT SERVER PORT1 PORT2 PORT3 PORT4 PORT5 ACS acscsa01 up up up up up All... (2 Replies)
Discussion started by: anand.aswini
2 Replies

4. UNIX for Dummies Questions & Answers

How to generate html reports through LINUX Scripting?

Hi All, I am trying to generate a weekly HTML report using LINUX Scripting. This will have record counts of some files. (like below) touch path/filename.html echo "Weekly Summary Report for Business Date : $P_BUS_DT">path/filename.html export A1=`cat path/filename1.txt |wc -l` echo "A1... (6 Replies)
Discussion started by: dsfreddie
6 Replies

5. Shell Programming and Scripting

BASH parsing for html tags

Hello can anyone help me parse this line. <tr><td>United States of America</td><td>Dollar</td><td>43.309</td></tr><tr><td>Japan</td><td>Yen</td><td>0.5579</td></tr> the line above did not break. so i would like to have a result like this United States of America Dollar 43.309 Japan... (3 Replies)
Discussion started by: doomsayer16
3 Replies

6. Shell Programming and Scripting

html/bash button

Hello everyone I am writing a cgi script in bash/html. I am trying something new with this one I have seperated the html code from the scripting. The html code is found in text files on the drive and the scripting is only one script in the cgi bin and i am using "<select multiple name="state"... (3 Replies)
Discussion started by: wlane7878
3 Replies

7. Shell Programming and Scripting

how to use html tag in shell scripting

Hai friends I have a small doubt.. how can we use html tag in shell scripting code : echo "<html>" echo "<body>" echo " welcome to peace world " echo "</body>" echo "</html>" output displayed like this: <html> <body> welcome to peace world </body> </html> (5 Replies)
Discussion started by: jrex1983
5 Replies

8. Shell Programming and Scripting

Remove html tags with bash

Hello, is there a way to go through a file and remove certain html tags with bash? If it needs sed or awk, that'll do too. The reason why I want this is, because I have a monitor script which generates a logfile in HTML and every time it generates a logfile, the tags are reproduced. The tags... (4 Replies)
Discussion started by: dejavu88
4 Replies

9. Shell Programming and Scripting

calling bash from html

I have a bash script (it downloads images and saves them) that I want to call from a link on a web page. I cant seem to make this work:mad: ? It works fine if I call it from command prompt. Any help much apprieciated.... (1 Reply)
Discussion started by: Leahy
1 Replies
Login or Register to Ask a Question