Not able to generate table in email body


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Not able to generate table in email body
# 1  
Old 07-02-2018
Not able to generate table in email body

Below is the code snippet and I'm not able to generate the table in email, output email has nothing

Code:
if [ -f $fName ]; then
echo "File $fName exists."
awk -F "," ' BEGIN {
print "MIME-Version: 1.0"
print "Content-Type: text/html"
print "Subject: Out OF Network Fee - Portfolio Level Stats"
print "<html><body><table border=1 cellspacing=0 cellpadding=3>"
print "<tr>"
for(i=1;i<=NF;i++)
print "<td>" $i"</td>"
print  "</tr>"
} END {
print "</table></body></html>"
 } ' $fName | mailx email

Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!
Please post in an adequate forum!

Last edited by RudiC; 07-02-2018 at 10:22 AM.. Reason: Added CODE tags; moved from "Post Here to Contact Site Administrators and Moderators"
# 2  
Old 07-02-2018
Welcome to the forum.

Please become accustomed to provide decent context info of your problem.

It is always helpful to carefully and detailedly phrase a request, and to support it with system info like OS and shell, related environment (variables, options), preferred tools, adequate (representative) sample input and desired output data and the logics connecting the two including your own attempts at a solution, and, if existent, system (error) messages verbatim, to avoid ambiguities and keep people from guessing.


Some comments to your above snippet:
- the fi is missing
- variable $fname is undefined
- there's only BEGIN and END sections in the awk snippet; no input is processed. Inserting a }{ before the print "<tr>" might bring you closer.
- email in not something mailx could send to.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regarding guidance related to HTML table in email body

Hello All, I have a query here. I am sending an HTML table(which I am creating it by a call to REST API, in a LINUX box) and from there I have to send it into an email. So following are the poins on same: As data is not static so it is writing Dynamic data and creating HTML file. There is... (9 Replies)
Discussion started by: RavinderSingh13
9 Replies

2. 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

3. Shell Programming and Scripting

Shell scripting unable to send the sql query data in table in body of email

I have written a shell script that calls below sql file. It is not sending the query data in table in the body of email. spool table_update.html; SELECT * FROM PROCESS_LOG_STATS where process = 'ActivateSubscription'; spool off; exit; Please use code tags next time for your code and data.... (9 Replies)
Discussion started by: Sharanakumar
9 Replies

4. UNIX for Advanced & Expert Users

Bold letter in email body

Hi All, The below is the email text and i want few words in BOLD. I am writing the below message in to a .txt file and calling it in a function which generated email. when i run at cmd prompt it is working fine , but wehn i run a script .sh it is not working. Below is the text printing in to... (2 Replies)
Discussion started by: kiranparsha
2 Replies

5. Shell Programming and Scripting

awk print the body of an email

I have fetched a couple of emails and stored then in /fetch/mail/oracle.txt, the displayed content is Date: From: Subject: To: Content-Type: ---body ----- --------- Date: From: Subject: To: Content-Type: ----body ----- ------ Date: From: I want to retrieve the body only from... (3 Replies)
Discussion started by: maddog21
3 Replies

6. Shell Programming and Scripting

issue with Email Body

Hi, I have written shell program to send email as below - #!/bin/ksh filename=`ls -ltrh *.Z` echo $filename |mailx -s "FOR TESTING" rahul.b@infotech.net I am getting the email but email body is - -rw-rw-r-- 1 bahulra dba 173M Mar 22 04:37 corphist.txt.Z -rw-rw-r-- 1 bahulra dba 107M... (3 Replies)
Discussion started by: rahulbahulekar
3 Replies

7. Shell Programming and Scripting

Crontab issue: getting email but with out body

I have a oracle sh script test.sh #!/bin/bash R=`sqlplus -S *****/*********@dfsdf <<ENDOFSQL set serveroutput on size unlimited; execute DBMS_SNAPSHOT.REFRESH( '"MIS_ADMIN"."MV_SURVEY_UNITS_CENSUS"','F'); execute DBMS_SNAPSHOT.REFRESH( '"MIS_ADMIN"."MV_SURVEY_UNITS_CENSUS_PART"','F');... (1 Reply)
Discussion started by: ramkia6
1 Replies

8. Shell Programming and Scripting

The body of the Email -- mailx

Hi, I am using mailx command to send an email and i took the body of the email from a file, mailx -r gtt.org -s "Status Report " ss@org.com < $ProcessStatisticsFile but now i want to declare the body of the email in the command itself. I have tried with the following command but... (4 Replies)
Discussion started by: chinnu01
4 Replies

9. Shell Programming and Scripting

emailing as body of email

hi all, how do i email a file in the body of an email rather than as an attachment ?? have a ksh script which i need to read a file and email as part of the body rather than an attachment. my code is : uuencode file.log | mailx -s "test" but this sends file as an attachment. ... (2 Replies)
Discussion started by: cesarNZ
2 Replies

10. Shell Programming and Scripting

how to check body of the email

Dears, i have user called dellsh i hope to make this script when this user recieve email check the budy of the email about (StatusRequest) when i find this email contain this subject run crontab do this job (create file in my home directory called index) thanks for your attention (1 Reply)
Discussion started by: dellsh
1 Replies
Login or Register to Ask a Question