Display both html and plain text in email in shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Display both html and plain text in email in shell script
# 1  
Old 05-24-2011
Question Display both html and plain text in email in shell script

Hi,

I want to display both html and plain in email in my script.

i tried the below code

code:

Code:
export MAILTO="ssi@a.com"
export CONTENT1="$htmlfile"
export CONTENT2="$plainfile"
export SUBJECT="INFO "
export MAILFROM="si@a.com"
(
echo "Subject: $SUBJECT"
echo "MIME-Version: 1.0"
echo "Content-Type: multipart/alternative; boundary=boundary-content_example";
echo "Content-Disposition: inline"
echo "--boundary-content_example"
echo "Content-Type: text/html"
cat $CONTENT
 
echo "--boundary-content_example"
echo "Content-Type: text/plain"
cat $CONTENT

echo "--boundary-content_example--"

) | sendmail -f $MAILFROM  $MAILTO


this is not working Smilie. I can see html page only no plaintext in email..

Please suggest me how to display both. Smilie

Last edited by pludi; 05-24-2011 at 07:21 AM..
# 2  
Old 05-26-2011
You cat cat'ing the same var/file for both.
# 3  
Old 05-26-2011
Did you want the files as attachments? Why not just send the email twice?
# 4  
Old 05-27-2011
Hi
You can try to cat for display as text file...
Code:
<PRE> `cat file` </PRE>

<PRE> tag display the file as it is....
# 5  
Old 05-31-2011
When you <pre> you need to escape [<>'"&] like & to &amp;, which sed can do.
Code:
$ cat mysrc/txt2html
#!/usr/bin/sed -f
 
s/\&/&amp;/g
s/"/\&quot/g
s/>/\&gt;/g
s/</\&lt;/g
s/'/\&apos;/g
 
$

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

HTML table in email body using C Shell

I am using Sun Solaris ver. 5.10 and trying to send an HTML table in email body using mail command in C shell script. I tried following commands:- #1 mail -m "MIME-Version: 1.0;Content-type:text/html;charset=UTF-8" receiver@mail.com < file.html #2 mail -m "Content-type: text/html;" -s "This... (4 Replies)
Discussion started by: jnrohit2k
4 Replies

2. Shell Programming and Scripting

HTML code upload text file grep through shell script

I am looking for HTML code that browse text file and grep with database file then retrieve result txtfileuploaded contain 112233 115599 113366 shell code grep -F -f txtfileuploaded /data/database.txt result 112233 Mar 41$ 115599 Nov 44$ 113366 Oct 33$ attached... (2 Replies)
Discussion started by: phpshell
2 Replies

3. Shell Programming and Scripting

how to send html email from shell script

This is my below script which is working fine as it send only plain text email. So My question is- How can I modify my below script to send this as an HTML formatted email? I want to show the text color of this expression `(echo "100*$TEST2/$TEST1" | bc -l)` as `RED` in an email and that can be... (3 Replies)
Discussion started by: raihan26
3 Replies

4. Shell Programming and Scripting

Bash shell script that inserts a text data file into an HTML table

hi , i need to create a bash shell script that insert a text data file into an html made table, this table output has to mailed.I am new to shell scripting and have a very minimum idea of shell scripting. please help. (9 Replies)
Discussion started by: intern123
9 Replies

5. Shell Programming and Scripting

Plain Text List to HTML List

Hello, I am trying to take a simple list (from echo, not a file) and turn it into a list with HTML codes. List item one. List item two. List item three. to <ol> <li>List item one.</li> <li>List item two.</li> <li>List item three.</li> </ol> The list is coming in via echo on... (4 Replies)
Discussion started by: QuestunAthority
4 Replies

6. Shell Programming and Scripting

shell send html email

I know how to send an email with sendmail in a shell script. I know how to send an email with an attachment in a script. But im trying to send an email and need to set Content-Type to text/html and insert a file as the body and not attachment. Send email with file as attachment: ... (4 Replies)
Discussion started by: Ikon
4 Replies

7. UNIX for Dummies Questions & Answers

Drag and drop items in plain html page

Hello, Am looking for a tool / open source framework that could do the following. A plain html page, with some toolbox at the border of the page where the tool box contains individual tool that represents operation like "extend fleet", "add drives", "backtrack" or something of that sort. ... (1 Reply)
Discussion started by: matrixmadhan
1 Replies

8. UNIX for Advanced & Expert Users

display HTML text in body using unix mailX ????

display HTML text in body using unix mailX ????Hello, could any one tell me how to display text in html layout by sending a file using mailx command in unix. i know to use mailx : mailx -s "SUBJECT" user.name@domail.com < file_name.txt instead of txt file i want to send html page and... (8 Replies)
Discussion started by: sparan_peddu
8 Replies

9. AIX

email from root sent my passord in plain text.

Root emailed me this message and thats ok it is supposed to. The thing that concerns me is that the ADMIN password came in plain text. I Xed it out for the purpose of this message of course. Is there a way for me to set this so the password comes encrypted? OR is not included at all in the... (4 Replies)
Discussion started by: rocker40
4 Replies

10. Shell Programming and Scripting

HTML display timing problem under ksh script

Using a HTML page , i'm running a Unix ksh script with <a href=..>. The script contains loop like this : for i in do rsh..... done each rsh command is running quite long and then i would display results in HTML format but about 5mn my blank page waiting for result is running in error... (1 Reply)
Discussion started by: Nicol
1 Replies
Login or Register to Ask a Question