Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Script output in Email is not showing Colored headers Post 302953111 by Corona688 on Tuesday 25th of August 2015 11:28:57 AM
Old 08-25-2015
ANSI escape sequences won't highlight colors in anything that's not a terminal. You mentioned HTML, but I see no HTML in your code. It's not about using the right editor, it's about sending text like <font color="red">test</font> instead of ANSI escape sequences.

As an aside, you don't need 2 extra steps, a temporary file, and a cat to email that -- just /var/log/test | sendmail example@bob.com

As another aside, you should never name a command test, there is a real command named test already.

As an aside to the aside, you shouldn't place commands inside /var/log.
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

colored data output

Hi, I am working with HP-UX 11. I try to make an colored data output with echo. I tried the following: echo "\033]32m Red" This works perfectly in my terminal. But when I type the same at the hpterm, it does not work, the terminal just prints the complete text "\033]32m Red" without... (1 Reply)
Discussion started by: bensky
1 Replies

2. UNIX for Dummies Questions & Answers

help:how to remove headers in output file

Hi I am running a script (which compares two directory contents) for which I am getting an output of 70 pages in which few pages are blank so I was able to delete those blank lines. But I also want to delete the headers present for each page. can any one help me by providing the code... (1 Reply)
Discussion started by: raj_thota
1 Replies

3. UNIX for Dummies Questions & Answers

Zshell Colored output

Hi All, is there anyway to color the output following a shell command? For instance: $cat somefile.txt Hello, I am the contents of somefile.txt I'm using zsh, with ANSI colors enabled. Thanks! (0 Replies)
Discussion started by: tolmark
0 Replies

4. Shell Programming and Scripting

getting colored output in perl

Hello, I am scripting in perl and I need to get my output of the "print" statement in color. Please tell me how to go ahead. Radha (2 Replies)
Discussion started by: s123.radha
2 Replies

5. Shell Programming and Scripting

convert email headers' encoding?

hi all - first, huge thanks to anyone who might be able to help me out with this. it's fairly esoteric, but it seems like there has to be an answer for me... * the environment: mac os x 10.5.x server communigate pro (mail server) bash script (read on) * the brief: my script is... (5 Replies)
Discussion started by: fearboy
5 Replies

6. Shell Programming and Scripting

Colored output in awk

Hi, Can anybody please help me how can we can we have the colored output using awk. I am writing a script in solaris platform. but its not printing the colored output. its assuming hex values as character awk -F"|" '{ print "\033 \033[1;31mabcd|efg\033[0m \033[1;31mabcd|efg\033[0m... (1 Reply)
Discussion started by: vikash_k
1 Replies

7. Shell Programming and Scripting

Input file is uncolored; I want the output file to be colored on criteria

Hello, I have the following input file: auditing account: 3DTP (3dtp) ERROR: S3 bucket "aws-origin-test1.3dstage.com" has policy statement with public grant: {"Sid":"PublicReadGetObject","Effect":"Allow","Principal":{"AWS":"*"},"Action":,"Resource":} auditing region: eu-west-1 auditing... (5 Replies)
Discussion started by: ramky79
5 Replies

8. UNIX for Dummies Questions & Answers

Email Headers

I'm trying to pick up some Unix SysAdmin skills on my own outside of work through the use of the "Unix and Linux System Administrators Handbook." I've found the exercises to be very beneficial, until I came to this.... "What path did the email take? To Whom was it addressed, and to whom was it... (0 Replies)
Discussion started by: ksmarine1980
0 Replies

9. Shell Programming and Scripting

Script showing incorrect output

Hello scripting geeks, I am new to scripting and facing some issues in writing the logic of the script. Request your kind help here Actually when i run a command i get o/p as below o/p : 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 these are hex values i guess...now i want to... (15 Replies)
Discussion started by: kulvant29
15 Replies

10. Shell Programming and Scripting

Color not showing in output text when sent via email

Hi, I have a test script where I am trying to make a line color in RED. It works when I execute the command from command line but when I try to send the output of the script via mailx it will not show me the color and instead show this output: Command to send script output to email: ... (1 Reply)
Discussion started by: tkhan9
1 Replies
Email::Abstract(3pm)					User Contributed Perl Documentation				      Email::Abstract(3pm)

NAME
Email::Abstract - unified interface to mail representations SYNOPSIS
my $message = Mail::Message->read($rfc822) || Email::Simple->new($rfc822) || Mail::Internet->new([split / /, $rfc822]) || ... || $rfc822; my $email = Email::Abstract->new($message); my $subject = $email->get_header("Subject"); $email->set_header(Subject => "My new subject"); my $body = $email->get_body; $rfc822 = $email->as_string; my $mail_message = $email->cast("Mail::Message"); DESCRIPTION
"Email::Abstract" provides module writers with the ability to write simple, representation-independent mail handling code. For instance, in the cases of "Mail::Thread" or "Mail::ListDetector", a key part of the code involves reading the headers from a mail object. Where previously one would either have to specify the mail class required, or to build a new object from scratch, "Email::Abstract" can be used to perform certain simple operations on an object regardless of its underlying representation. "Email::Abstract" currently supports "Mail::Internet", "MIME::Entity", "Mail::Message", "Email::Simple" and "Email::MIME". Other representations are encouraged to create their own "Email::Abstract::*" class by copying "Email::Abstract::EmailSimple". All modules installed under the "Email::Abstract" hierarchy will be automatically picked up and used. METHODS
All of these methods may be called either as object methods or as class methods. When called as class methods, the email object (of any class supported by Email::Abstract) must be prepended to the list of arguments, like so: my $return = Email::Abstract->method($message, @args); This is provided primarily for backwards compatibility. new my $email = Email::Abstract->new($message); Given a message, either as a string or as an object for which an adapter is installed, this method will return a Email::Abstract object wrapping the message. If the message is given as a string, it will be used to construct an object, which will then be wrapped. get_header my $header = $email->get_header($header_name); my @headers = $email->get_header($header_name); This returns the values for the given header. In scalar context, it returns the first value. set_header $email->set_header($header => @values); This sets the $header header to the given one or more values. get_body my $body = $email->get_body; This returns the body as a string. set_body $email->set_body($string); This changes the body of the email to the given string. WARNING! You probably don't want to call this method, despite what you may think. Email message bodies are complicated, and rely on things like content type, encoding, and various MIME requirements. If you call "set_body" on a message more complicated than a single-part seven-bit plain-text message, you are likely to break something. If you need to do this sort of thing, you should probably use a specific message class from end to end. This method is left in place for backwards compatibility. as_string my $string = $email->as_string; This returns the whole email as a decoded string. cast my $mime_entity = $email->cast('MIME::Entity'); This method will convert a message from one message class to another. It will throw an exception if no adapter for the target class is known, or if the adapter does not provide a "construct" method. object my $message = $email->object; This method returns the message object wrapped by Email::Abstract. If called as a class method, it returns false. Note that, because strings are converted to message objects before wrapping, this method will return an object when the Email::Abstract was constructed from a string. PERL EMAIL PROJECT
This module is maintained by the Perl Email Project <http://emailproject.perl.org/wiki/Email::Abstract> AUTHOR
Casey West, <casey@geeknest.com> Simon Cozens, <simon@cpan.org> Ricardo SIGNES, <rjbs@cpan.org> COPYRIGHT AND LICENSE
Copyright 2004 by Simon Cozens This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2011-02-18 Email::Abstract(3pm)
All times are GMT -4. The time now is 11:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy