Regarding guidance related to HTML table in email body


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Regarding guidance related to HTML table in email body
# 1  
Old 07-27-2016
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:
  1. As data is not static so it is writing Dynamic data and creating HTML file.
  2. There is a table which has many fields into it in that HTML file.
  3. I am sending this HTML table into an email by shell script(command sendmail).
  4. All field's value could be of any length.
So above are some information points on this, following is the question now on same.

Query:
As I mentioned above field's length could be any. So when I am sending that email with HTML table, so it's one field has more length compare of any other field, so because of it all other fields(including columns and data) are shrinking into size and it is looking very odd in email. Basically I require all the fields to be same width and all values should come in single line into email, off course there could be a limit for wordwrap but field's data should go till that but that's not happening.

Following are the things I had tried too in order to fix it(which didn't work):
  1. Tried to fix table's width.
  2. Used {"white-space: nowrap"}.

Tried above but it didn't work, I can't paste data here apologies for it but I have tried my best to explain the issue, please do let me know if any further information required here too. Could anyone please help in same, will be grateful.

Thanks,
R. Singh

Last edited by rbatte1; 07-28-2016 at 07:52 AM.. Reason: Converted text list with roman numerals with LIST=i tags
# 2  
Old 07-27-2016
Try using table cell with nowrap attribute:-
Code:
<td nowrap>

By the way white-space is a CSS property, show us how you are using it.
# 3  
Old 07-27-2016
Quote:
Originally Posted by Yoda
Try using table cell with nowrap attribute:-
Code:
<td nowrap>

By the way white-space is a CSS property, show us how you are using it.
Thanks Yoda for your reply, yes it is a css property but we could use it either with head and style tags or we could use it in td tag. I tried both but nothing worked. Sorry can't paste samples but it is very easy to predict like the last field/any filed is having long length data so all other fields are shrinking, which I don't want to be. Could you/form please guide me in same.

Thanks,
R. Singh
# 4  
Old 07-27-2016
What email client is this being shown in? Microsoft ones restrict a lot of HTML features to avoid having to actually patch any security holes.
This User Gave Thanks to Corona688 For This Post:
# 5  
Old 07-28-2016
Quote:
Originally Posted by Corona688
What email client is this being shown in? Microsoft ones restrict a lot of HTML features to avoid having to actually patch any security holes.
Thank you for your reply Corona688, yes it is Microsoft Outlook client. Could you please guide me in same.

Thanks,
R. Singh
# 6  
Old 07-28-2016
Please post sample data
# 7  
Old 08-04-2016
Hello All,

I have solved my problem in this thread, sorry for late reply on this.
Following is my test data.
Code:
_____________________________________________________________________________________________
|TEST | TEST_1 | TEST_2_   | TEST_3 | TEST_4 | TEST_5_TES_TEST_TEST_TEST_TEST_TEST_TEST_TEST|
|     |        |AGAIN_TEST |        |        |                                              |
 _____________________________________________________________________________________________

Not sure if above gives clear picture of question or not. As we could see some column's data are not coming into a single line. So I wanted to have them in a single line. So in order to fix this in email(outlook client) I have increased the length of the problematic columns let's say column 6th I have changed from test_test_test to test_singh_test_singh_test so it has increased the width of the whole column in table. I had tried seveal options in it but it didn't work so in order to fix it I have done this non-technical fix. If anyone has any fix for this, it is always welcome.

Thanks,
R. Singh

Last edited by RavinderSingh13; 08-05-2016 at 03:48 AM.. Reason: Made Input_file(test one) by a script and pasting it here as code tags were not able to print HTML table.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

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 if ; 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... (1 Reply)
Discussion started by: vyomdev
1 Replies

2. Shell Programming and Scripting

Postgre Query results as Email HTML table

Hello, I'm trying to send email from Greenplum query results as HTML table with status Red/Green Select Server, Last_Date from Table; Results Server, Last_Date Prod, 2018-04-09 Final email Output in HTML format Server Status LastDate Prod GREEN(BOX) 2018-04-09 (if... (2 Replies)
Discussion started by: krux_rap
2 Replies

3. UNIX for Dummies Questions & Answers

Convert Txt file to HTML table and email

Hi all I need help converting a text file into a html table in bash and I need to email this table. The text file looks like the below. Two columns with multiple rows. Top row being header. Application Name Application Status Application 1 Open Application 2 ... (2 Replies)
Discussion started by: hitmanjd
2 Replies

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

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

6. Shell Programming and Scripting

SQL query output convert to HTML & send as email body

Hi , I have a sql query in the unix script ,whose output is shown below.I want to convert this output to HTML table format & send email from unix with this table as email body. p_id src_system amount 1 A 100 2 B 200 3 C ... (3 Replies)
Discussion started by: jagadeeshn04
3 Replies

7. Shell Programming and Scripting

Email body not formatted with html and sendmail

Hi All, I am trying to send the contents of a file as email body. I am using html email and sendmail option of unix. I am using the below piece of code for the same : #!/usr/bin/ksh export MAILTO="email@domain.com" export SUBJECT="Report" export BODY="file_directory_path/test_file.txt"... (1 Reply)
Discussion started by: rockygsd
1 Replies

8. UNIX for Advanced & Expert Users

Mutt for html body and multiple html & pdf attachments

Hi all: Been racking my brain on this for the last couple of days and what has been most frustrating is that this is the last piece I need to complete a project. There are numerous posts discussing mutt in this forum and others but I have been unable to find similar issues. Running with... (1 Reply)
Discussion started by: raggmopp
1 Replies

9. UNIX for Advanced & Expert Users

Email with multiple attachments & HTML body

I have a html file: # cat sample.html <html> <body> Sample HTML file</p> </body> </html> And I have two excel sheets (sheet1.xls & sheet2.xls) I want to send an email by having the sample.html as the message body and two spreadsheets as the attachments. I tried using the below command:... (12 Replies)
Discussion started by: BHM
12 Replies

10. Shell Programming and Scripting

Referring to attached images in html email body through mailx

encoding type for images? (5 Replies)
Discussion started by: biswasbaishali
5 Replies
Login or Register to Ask a Question