Perl email standout


 
Thread Tools Search this Thread
Top Forums Programming Perl email standout
# 1  
Old 06-18-2013
Perl email standout

Hi Perl Gurus

I am once again in need of your help

i have this lovely bit of code

Code:
for my $w (@$decoded_json) {
	if ($w->{status} == 1){
		print "Warning:\n";
		printf "%-20s %-25s %-25s",  $w->{client}, $w->{check}, $w->{issued}  ;
		print "\n\n";
	}
	if ($w->{status} == 2){
		print "Critical:\n";
		printf "%-20s %-25s %-25s",  $w->{client}, $w->{check}, $w->{issued}  ;
	}
}

which will return to the terminal

Code:
Warning:
es1.dneg.com.        disk_usage                1371540417

Critical:
sensu.dneg.com.      check_git_SITE_scripts    1371540429


but i want to be able to email it as well
any ideas how i can do that?

i would normally stick it all in a new variable and then email that i,e

Code:
 my $report = ( blah blah blah) 
system ("echo \"$report\" | mail -s test@dneg.com)


any ideas how i could do it with the code i did
# 2  
Old 06-19-2013
email is plain (ASCII) text, so a native standout mode is out of the question.

If you use HTML email you can add some html markup for standout, if you display the email on a terminal you can embed this terminals standout modes (usually in form of ESC-sequences), but this will work for a specific terminal only.

I hope this helps.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Perl - EMail issue - NEED Help

I have a perl that is sending emails in a bad format: "begin 644 Included.doc M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ M*BHJ*BHJ*BHJ*BH*4U5#0T534T953"!-1$XG<R!F;W(@07)C:&EV92!022`M M($-A;F-E;`HJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ... (1 Reply)
Discussion started by: mrn6430
1 Replies

2. Shell Programming and Scripting

Email from a Perl Script....?

Hi, how do i send an email from a Perl script? i.e. what is Perl's equivalent to mailx? i have my script working where it prints out an error to a screen, but instead i'd like it sent to email. any pointers would be greatly appreciated. (1 Reply)
Discussion started by: horhif
1 Replies

3. Shell Programming and Scripting

Using top command to email if process is exceeding 25% and sending an email alert if so

This is my first time writing a script and Im having some trouble, Im trying to use the top command to monitor processes and the amount of CPU usage they require, my aim is to get an email if a process takes over a certain percentage of CPU usage I tried grep Obviosly that hasnt worked, Any... (8 Replies)
Discussion started by: jay02
8 Replies

4. Shell Programming and Scripting

perl check email script not seeing attachment

The following script does pull the sender and Subject of the email but it is not seeing the attachment name. I know there is an attachment. I line in red SHOULD pull the filename out. this line is in the message: Content-Disposition: attachment; filename="Picture 243.jpg" ... (1 Reply)
Discussion started by: Ikon
1 Replies

5. Shell Programming and Scripting

perl script to send an email executing with errors

Hello , i am using RHEL5 , i have got a perl script that executes and sends an email correctly if i run it with ./sendemail.sh command. This is the script below #! /usr/bin/perl use Net::SMTP; print "starting email send ."; $smtp = Net::SMTP->new("192.168.0.1");... (2 Replies)
Discussion started by: kabazzi
2 Replies

6. Shell Programming and Scripting

Sending email and attachment file using Perl

I am trying to send an email body of information and also attachment using perl script, but I am only able to send the body but not an attachment. is there around it without using "use MIME::Lite;" module. $user = "bataf\@xyz.com"; $subjectt = "mail from perl"; open(MAIL, "| mailx -s... (1 Reply)
Discussion started by: bataf
1 Replies

7. UNIX for Dummies Questions & Answers

run a perl.script upon receiving an email in Sendmail

Hi All I am newbie with Sendmail and Linux in general. We use sendmail for outgoing and incoming mails. Once our server receives a certain email xxx@yyy.com we would like to run a PERL script doing some task wiht it. Can you address me a little bit on that topic? In order to do that the... (0 Replies)
Discussion started by: manustone
0 Replies

8. Shell Programming and Scripting

How to read email using mailx in shell script or perl

Hello, I am new to mailx and perl and I need help. I need create a shell script to read the mails on the SUN server, then parse the subject line and message body of each email to extract particular data so that I can pass these data fields in as application parameters to invoke a java... (4 Replies)
Discussion started by: jliharper
4 Replies

9. UNIX for Advanced & Expert Users

Manipulating Standout Output

I am trying to insert tab's in place of spaces when I tail -f a log and pipe it with grep and cut. Is there a way to take the stdout and format in a way that is tabbed so that all the information is stacked appropriately. I've tried using unexpand. But that did not work. I basically need to... (2 Replies)
Discussion started by: cubs0729
2 Replies

10. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies
Login or Register to Ask a Question