Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I must be perl-tarded but here goes. i am trying to setup and send a simple email and fooey no emails working yet, I have replaced the servername and username password stuff, they did have valid values what I do get is the number of processes and no errors aside from global variable $msg requires explicit package name. I am on a windows system 2003 server, using mime:lite and trying to use smtp but probably doing it wrong here is my code. ok you can give me a hard time if you want I just want to understand what is wrong aside from the complaining about that variable which is because of warnings and strict being on, cause everybody says to use warnings and strict. my shebang line has -w trust me it does.. I also want to loop this check so that it runs for several hours once an hour this should do for about 30 hours right?
use Win32::Process::List; use Mail::Sender; use MIME::Lite; use strict; my $numloops=0; my $timer=6000; while($numloops>30){ $numloops++ sleep $timer; my $P = Win32::Process::List->new(); if($P->IsError == 1) { print "an error occured: " . $P->GetErrorText . "\n"; } my %list = $P->GetProcesses(); my $anz = scalar keys %list; print "Anzal im Array= $anz\n"; my $count = 0; foreach my $key (keys %list) { # $list{$key} is now the process name and $key is the PID #print sprintf("%20s has PID %10s", $list{$key}, $key) . "\n"; $count++; } print "Number of processes: $count\n"; my $process = "mmdrv.exe"; my %hPIDS = $P->GetProcessPid($process); print keys (%hPIDS) . "\n"; if(%hPIDS) { foreach (keys %hPIDS) { print "$_ has PID " . $hPIDS{$_} . "\n"; } } else { print "Process(s) not found\n"; #exit; my $test= MIME::Lite->send('smtp', "servername@mydomain.com", AuthUser=>"$username",AuthPass=>"$Pass" ); my $msg = MIME::Lite->new( From =>'validemail@mydomain.com', To =>'validemail@mydomain.com', Cc =>'some@other.com, some@more.com', Subject =>'Hello testing email from perl heartbeat monitor sc +ript', Data =>"Loadrunner is running!" ); } }

In reply to mime lite by grashoper

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (None)
    As of 2024-04-25 01:07 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found