|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Mailx command - send mail as table format
I have to send a couple of rows that have been returned from a SQL query. I have written the output of the query to a file and while i try to print this in the mail body the formatting goes wrong.
Intended Output in mail body: Col1 Col2 Col3 ------ ------- ------ Bombay Raj 23 Delhi Raja 24 etc.. But what i get currently is : Col1 Col2 Col3 ---- ----- ------ Bombay Raj 23 Delhi Raja 24 etc.. Please suggest a way how i can format this in the mail body. P.S: The file to which i re-direct the query output is formatted as required, but the mail body isnt. Please help. TIA! ---------- Post updated at 09:58 PM ---------- Previous update was at 09:56 PM ---------- Sorry the intended output has to have the right amount of spaces. Somehow the spaces disappeared in the post. Please help. TIA! |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
try using below set in SQL query ..... Code:
set pagesize 0 set lines 1000 set echo on set heading on Code:
(cat body; uuencode attch1 attch1; uuencode attch2 attch2; ) | mailx -m -s "testing" ksatisha@ycom |
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
Use HTML formatting with sendmail:- Code:
awk ' BEGIN {
print "From: abc@pqr.com"
print "To: xyz@pqr.com"
print "MIME-Version: 1.0"
print "Content-Type: text/html"
print "Subject: Your Subject"
print "<html><body><table border=1 cellspacing=0 cellpadding=3>"
print "<tr>"
print "<td>Col 1</td>";
print "<td>Col 2</td>";
print "<td>Col 3</td>";
print "</tr>"
} {
print "<tr>"
print "<td>"$1"</td>";
print "<td>"$2"</td>";
print "<td>"$3"</td>";
print "</tr>"
} END {
print "</table></body></html>"
} ' SQL_query_output_file | sendmail -tI hope this helps. |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to send html file in a mail not as an attachment but it should display in the mail in table for | mani_isha | UNIX for Dummies Questions & Answers | 0 | 03-30-2010 03:37 AM |
| Unable to send e-mail using mailx command | manas6 | UNIX for Dummies Questions & Answers | 1 | 01-22-2009 03:53 AM |
| Problem with Mailx command to send mail with attachment | viswanatharv | Shell Programming and Scripting | 5 | 11-06-2008 01:10 PM |
| How to convert the data into excel sheet and send mail using 'mailx' command | sanbabu | Shell Programming and Scripting | 5 | 10-14-2008 04:12 PM |
| unable to sent mail in html format by mailx command. | p_prathaban | UNIX for Advanced & Expert Users | 17 | 11-07-2007 02:03 AM |
|
|