Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Not able to generate table in email body Post 303019569 by vyomdev on Monday 2nd of July 2018 08:54:11 AM
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"
 

10 More Discussions You Might Find Interesting

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

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

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

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

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

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

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

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

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

10. 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
Courriel(3pm)						User Contributed Perl Documentation					     Courriel(3pm)

NAME
Courriel - High level email parsing and manipulation VERSION
version 0.29 SYNOPSIS
my $email = Courriel->parse( text => $raw_email ); print $email->subject(); print $_->address() for $email->participants(); print $email->datetime()->year(); if ( my $part = $email->plain_body_part() ) { print $part->content(); } DESCRIPTION
This software is still very alpha, and the API may change without warning in future versions. This class exists to provide a high level API for working with emails, particular for processing incoming email. It is primarily a wrapper around the other classes in the Courriel distro, especially Courriel::Headers, Courriel::Part::Single, and Courriel::Part::Multipart. If you need lower level information about an email, it should be available from one of these classes. API
This class provides the following methods: Courriel->parse( text => $raw_email, is_character => 0|1 ) This parses the given text and returns a new Courriel object. The text can be provided as a string or a reference to a string. If you pass a reference, then the scalar underlying the reference will be modified, so don't pass in something you don't want modified. By default, Courriel expects that content passed in text is binary data. This means that it has not been decoded into utf-8 with "Encode::decode()" or by using a ":encoding(UTF-8)" IO layer. In practice, this doesn't matter for most emails, since they either contain only ASCII data or they actually do contain binary (non- character) data. However, if an email is using the 8bit Content-Transfer-Encoding, then this does matter. If the email has already been decoded, you must set "is_character" to a true value. It's safest to simply pass binary data to Courriel and let it handle decoding internally. $email->parts() Returns an array (not a reference) of the parts this email contains. $email->part_count() Returns the number of parts this email contains. $email->is_multipart() Returns true if the top-level part is a multipart part, false otherwise. $email->top_level_part() Returns the actual top level part for the object. You're probably better off just calling "$email->parts()" most of the time, since when the email is multipart, the top level part is just a container. $email->subject() Returns the email's Subject header value, or "undef" if it doesn't have one. $email->datetime() Returns a DateTime object for the email. The DateTime object is always in the "UTC" time zone. This uses the Date header by default one. Otherwise it looks at the date in each Received header, and then it looks for a Resent-Date header. If none of these exists, it just returns "DateTime->now()". $email->from() This returns a single Email::Address object based on the From header of the email. If the email has no From header or if the From header is broken, it returns "undef". $email->participants() This returns a list of Email::Address objects, one for each unique participant in the email. This includes any address in the From, To, or CC headers. Just like with the From header, broken addresses will not be included. $email->recipients() This returns a list of Email::Address objects, one for each unique recipient in the email. This includes any address in the To or CC headers. Just like with the From header, broken addresses will not be included. $email->to() This returns a list of Email::Address objects, one for each unique address in the To header. Just like with the From header, broken addresses will not be included. $email->cc() This returns a list of Email::Address objects, one for each unique address in the CC header. Just like with the From header, broken addresses will not be included. $email->plain_body_part() This returns the first Courriel::Part::Single object in the email with a mime type of "text/plain" and an inline disposition, if one exists. $email->html_body_part() This returns the first Courriel::Part::Single object in the email with a mime type of "text/html" and an inline disposition, if one exists. $email->clone_without_attachments() Returns a new Courriel object that only contains inline parts from the original email, effectively removing all attachments. $email->first_part_matching( sub { ... } ) Given a subroutine reference, this method calls that subroutine for each part in the email, in a depth-first search. The subroutine receives the part as its only argument. If it returns true, this method returns that part. $email->all_parts_matching( sub { ... } ) Given a subroutine reference, this method calls that subroutine for each part in the email, in a depth-first search. The subroutine receives the part as its only argument. If it returns true, this method includes that part. This method returns all of the parts that match the subroutine. $email->content_type() Returns the Courriel::Header::ContentType object associated with the email. $email->headers() Returns the Courriel::Headers object for this email. $email->stream_to( output => $output ) This method will send the stringified email to the specified output. The output can be a subroutine reference, a filehandle, or an object with a "print()" method. The output may be sent as a single string, as a list of strings, or via multiple calls to the output. For large emails, streaming can be much more memory efficient than generating a single string in memory. $part->as_string() Returns the email as a string, along with its headers. Lines will be terminated with " ". ROBUSTNESS PRINCIPLE
Courriel aims to respect the common Internet robustness principle (aka Postel's law). Courriel is conservative in the output it generates, and liberal in what it accepts. When parsing, the goal is to never die and always return as much information as possible. Any input that causes the "Courriel->parse()" to die means there's a bug in the parser. Please report these bugs. Conversely, Courriel aims to respect all relevant RFCs in its output, except when it preserves the original data in a parsed email. If you're using Courriel::Builder to create emails from scratch, any output that isn't RFC-compliant is a bug. FUTURE PLANS
This release is still rough, and I have some plans for additional features: More methods for walking all parts Some more methods for walking/collecting multiple parts would be useful. More? Stay tuned for details. WHY DID I WRITE THIS MODULE
? There a lot of email modules/distros on CPAN. Why didn't I use/fix one of them? o Mail::Box This one probably does everything this module does and more, but it's really, really big and complicated, forcing the end user to make a lot of choices just to get started. If you need it, it's great, but I generally find it to be too much module for me. o Email::Simple and Email::MIME These are surprisingly not simple. They suffer from a problematic API (too high level in some spots, too low in others), and a poor separation of concerns. I've hacked on these enough to know that I can never make them do what I want. o Everything Else There's a lot of other email modules on CPAN, but none of them really seem any better than the ones mentioned above. CREDITS
This module rips some chunks of code from a few other places, notably several of the Email suite modules. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT AND LICENSE
This software is Copyright (c) 2012 by Dave Rolsky. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) perl v5.14.2 2012-03-07 Courriel(3pm)
All times are GMT -4. The time now is 11:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy