Sponsored Content
Top Forums Shell Programming and Scripting Trying to email text, getting blank email Post 302575982 by BG_JrAdmin on Wednesday 23rd of November 2011 10:30:09 AM
Old 11-23-2011
Trying to email text, getting blank email

Hello, and thank you for help in advance, i seem to have this script working, except for the email part, it sends me a blank email, am i not redirecting the output of my text file the right way?


Code:
#!/usr/bin/ksh

rm installed_zones.txt

installed=/home/xxx/stuff/installed_zones.txt

for EACH in `cat serverlist.txt`
do
ssh $EACH zoneadm list -ipc | grep running | grep -v "global" >> installed_zones.txt
done

if [ -s installed_zones.txt ] ; then
cat /home/xxx/stuff/installed_zones.txt | mail xxx@xxx.com
               exit
else
echo NO INSTALLED ZONES  | mail xxx@xxx.com
               exit
fi


Last edited by BG_JrAdmin; 11-23-2011 at 06:26 PM..
 

8 More Discussions You Might Find Interesting

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

2. UNIX for Dummies Questions & Answers

Send email where # is in the email address - Using Unix

Hi All, How do I send an email using malix where email address contains a #. I have a email address like this : #test@test.com I want to send email like malix -s "TEST" #test@test.com < SOMEFILE I tried \# but doesn't work. Please let me know how we can achieve this? I am in... (1 Reply)
Discussion started by: jingi1234
1 Replies

3. Solaris

Send an email from Solaris using Linux email server

Hello everyone I have a problem and I need your help: I have a Solaris 10 and Solaris 8 UNIX Servers, and Linux Centos4 as email server. I need send an email from Solaris servers preferably using Centos4 email server. I have no mail service configured in my Solaris computers (1 Reply)
Discussion started by: aflores
1 Replies

4. UNIX for Dummies Questions & Answers

new to ldap, send email to a ou or group, and see a list from email client

hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version). i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010). a. i cant see a list of the contacts,... (0 Replies)
Discussion started by: V4705
0 Replies

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

6. SuSE

Send outgoing email to my GroupWise email

Dear users, I have Linux server whose versions are Suse 10 SP 3 and Suse 11. I am trying to send email from these servers to my GroupWise email account. In /etc/postfix/main.cf file, The current value of MYHOSTNAME is LINUX.LOCAL. What should be the right value of MYHOSTNAME? Is... (0 Replies)
Discussion started by: JDBA
0 Replies

7. Shell Programming and Scripting

Getting email output in single line with out space in email

I have tried below email method and i am getting every thing in single line . i have put echo to provide space, but it is not helping my code ( echo "From: $FROM" echo "To: $MAILTO" echo "CC: $CC" echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo 'Content-Type: multipart/mixed;... (6 Replies)
Discussion started by: mirwasim
6 Replies

8. Shell Programming and Scripting

Adding a blank line in between two O/Ps in tabular format which gets received over email

Hi Guys, I am stuck in between and seeking help here. Requirement: A script that will run every morning which will connect to Mysql database and run the query to inform us about the holidays (it will also check if there were any holidays during last 2 business days). So the three queries are... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies
Test::Email(3pm)					User Contributed Perl Documentation					  Test::Email(3pm)

NAME
Test::Email - Test Email Contents SYNOPSIS
use Test::Email; # is-a MIME::Entity my $email = Test::Email->new(@lines); # all-in-one test $email->ok({ # optional search parameters from => ($is or qr/$regex/), subject => ($is or qr/$regex/), body => ($is or qr/$regex/), headername => ($is or qr/$regex/), }, "passed tests"); # single-test header methods $email->header_is($header_name, $value, "$header_name matches"); $email->header_ok($header_name, $value, "$header_name matches"); $email->header_like($header_name, qr/regex/, "$header_name matches"); # single-test body methods $email->body_is($header_name, $value, "$header_name matches"); $email->body_ok($header_name, $value, "$header_name matches"); $email->body_like($header_name, qr/regex/, "$header_name matches"); # how many MIME parts does the messages contain? $email->parts_ok($parts_count, "there were $parts_count parts found"); # what is the MIME type of the firs part my @parts = $email->parts(); # see MIME::Entity $parts[0]->mime_type_ok('test/html', 'the first part is type text/html'); DESCRIPTION
Please note that this is ALPHA CODE. As such, the interface is likely to change. Test::Email is a subclass of MIME::Entity, with the above methods. If you want the messages fetched from a POP3 account, use Test::POP3. Tests for equality remove trailing newlines from strings before testing. This is because some mail messages have newlines appended to them during the mailing process, which could cause unnecessary confusion. This module should be 100% self-explanatory. If not, then please look at Test::Simple and Test::More for clarification. METHODS
"my $email = Test::Email->new($lines_aref);" This is identical to "MIME::Entity->new()". See there for details. "$email->ok($test_href, $description);" Using this method, you can test multiple qualities of an email message with one test. This will execute the tests as expected and will produce output just like "Test::Simple::ok" and "Test::More::ok". Keys for $test_href are either "body", or they are considered to be the name of a header, case-insensitive. single-test methods The single-test methods in the synopsis above are very similar to their counterparts in Test::Simple and Test::More. Please consult those modules for documentation. Please note that tests for equality remove newlines from their operands before testing. This is because some email messages have newlines appended to them during mailing. "my $ok = $email-"parts_ok($parts_count, $description);> Check to see how many MIME parts this email contains. Each part is also a Test::Email object. "my $ok = $email-"mime_type_ok($expected_mime_type, $description);> Check the MIME type of an email or an email part. EXPORT
None. SEE ALSO
Test::Builder, Test::Simple, Test::More, Test::POP3 TODO
I am open to suggestions. AUTHOR
James Tolley, <james@cpan.org> COPYRIGHT AND LICENSE
Copyright (C) 2007-2008 by James Tolley This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available. perl v5.10.0 2008-10-24 Test::Email(3pm)
All times are GMT -4. The time now is 08:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy