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
Welcome to forums,
This is one way
$ echo "<html><b>This is bold</b></html>" | mail -a "Content-type: text/html;" -s "Testing" user@domain.com
1 Like
can you tell me how to wite one by one
and in colors say for red color
You can use font color attribute or style even,
example :
<p><font color="red">this is red</font></p>
<p style='color:red;'>This is red</p>
if you are new to html, you may go through some tutorial from here
But anyways I do not get all these in email my email is blank:
Okay try this script
$ cat email_content.html
<html><b>This is bold</b></html>
# !/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
when I try to send to many DLs it is not working:<