From: Dylan Penhale <dylan@(email surpressed)>
Subject: rushsendmail question
   Date: Tue, 30 Aug 2005 00:55:12 -0700
Msg# 1016
View Complete Thread (3 articles) | All Threads
Last Next
We have modified our submit script to file check frames and 
Que/neverhost if the frame is incomplete, but I want to be able to 
send a mail when ever that process occurs. 

I'm looking at the rushsendmail binary but I can't see how to issue 
the whole command as one line without using an external file. This 
will run on windows so I can't use the nix mail command.

I want to issue a command something like:

system("rushsendmail -f rush@(email surpressed) alert@(email surpressed) . 
-s "Alert: $ENV{RUSH_HOSTNAME} was neverhosted" . 
);

However I don't think rushsendmail has an -s option and also a flag 
for the message body. 

So I tried to pipe an echo'ed statement into the rushsendmail but I 
can't seem to get multiple lines in DOS echo command, so I can't feed 
To: 
Subject:
etc...

e.g.

      system("echo To: sysadmin@(email surpressed)\n" .
                 "Subject: Error on on $ENV{RUSH_HOSTNAME}\n" .
                 "$ENV{RUSH_PADFRAME} " .
                 "on $ENV{RUSH_HOSTNAME}: Didn't manage output.\n " .
                 "Added as neverhost and re-queued \n" .
                 "| c:\rush\etc\bin\rushsendmail -f " .
		 "sysadmin@(email surpressed).");


Or perhaps there is a delimit char or charage return flag?

I do have a way out in that I can rsh the command to a mail server on 
the network but it's a bit messy.

Any ideas?

-- 
Dylan Penhale
Systems Administrator
Fuel International
65 King Street
Newtown
Sydney
NSW 2042

Phone:  xxxxxxxxxx
Mobile: xxxxxxxxxx
Web:    www.fuel-depot.com

   From: Dylan Penhale <dylan@(email surpressed)>
Subject: Re: rushsendmail question - follow up
   Date: Thu, 01 Sep 2005 22:40:04 -0700
Msg# 1017
View Complete Thread (3 articles) | All Threads
Last Next
Just to follow up we ended up using the built in perl SMTP module 
Net::SMTP module which is part of the "libnet" bundle.


Dylan


On Tue, 30 Aug 2005 05:55 pm, Dylan Penhale wrote:
> [posted to rush.general]
>
> We have modified our submit script to file check frames and
> Que/neverhost if the frame is incomplete, but I want to be able to
> send a mail when ever that process occurs.
>
> I'm looking at the rushsendmail binary but I can't see how to issue
> the whole command as one line without using an external file. This
> will run on windows so I can't use the nix mail command.
>
> I want to issue a command something like:
>
> system("rushsendmail -f rush@(email surpressed) alert@(email surpressed) .
> -s "Alert: $ENV{RUSH_HOSTNAME} was neverhosted" .
> );
>
> However I don't think rushsendmail has an -s option and also a flag
> for the message body.
>
> So I tried to pipe an echo'ed statement into the rushsendmail but I
> can't seem to get multiple lines in DOS echo command, so I can't
> feed To:
> Subject:
> etc...
>
> e.g.
>
>       system("echo To: sysadmin@(email surpressed)\n" .
>                  "Subject: Error on on $ENV{RUSH_HOSTNAME}\n" .
>                  "$ENV{RUSH_PADFRAME} " .
>                  "on $ENV{RUSH_HOSTNAME}: Didn't manage output.\n "
> . "Added as neverhost and re-queued \n" .
>                  "| c:\rush\etc\bin\rushsendmail -f " .
> 		 "sysadmin@(email surpressed).");
>
>
> Or perhaps there is a delimit char or charage return flag?
>
> I do have a way out in that I can rsh the command to a mail server
> on the network but it's a bit messy.
>
> Any ideas?

-- 
Dylan Penhale
Systems Administrator
Fuel International
65 King Street
Newtown
Sydney
NSW 2042

Phone:  xxxxxxxxxx
Mobile: xxxxxxxxxx
Web:    www.fuel-depot.com

   From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: rushsendmail question - follow up
   Date: Fri, 02 Sep 2005 00:10:32 -0700
Msg# 1018
View Complete Thread (3 articles) | All Threads
Last Next
Dylan Penhale wrote:
[posted to rush.general]

Just to follow up we ended up using the built in perl SMTP module Net::SMTP module which is part of the "libnet" bundle.

Hi Dylan,

	Sorry, I forgot to answer your original post.
	Yes, it's probably wise to use the Perl SMTP module. eg:

---- snip
#!/usr/bin/perl -w
use strict;
use Net::SMTP;
my $mailfrom     = 'you@(email surpressed)';	# from address
my $mailto       = 'them@(email surpressed)';	# to address
my $relay        = 'relay.here.com';	# your mail server hostname
my $smtp = Net::SMTP->new($relay);
if ( ! defined($smtp) )
{
    # ERROR OCCURRED -- TRY AGAIN W/DEBUG ENABLED
    $smtp = Net::SMTP->new($relay, Debug => 1);
    if ( !defined($smtp) )
        { print "ERROR: Could not connect to $relay (see above)\n"; exit(1); }
}
# NOTE: Error checking an exercise to reader..
#       for each of the following, check return code. eg. $errs |= $smtp->mail($mailto);
#       Also, you probably should add Reply-To, Errors-To and Return-Path fields.
$smtp->mail($mailto);
$smtp->to($mailto);
$smtp->data();
$smtp->datasend("From: $mailfrom\n");
$smtp->datasend("To: $mailto\n");
$smtp->datasend("Subject: testing\n");
$smtp->datasend("\n");
$smtp->datasend("Line one");
$smtp->datasend("Line two");
$smtp->dataend();
$smtp->quit;
---- snip

I'm looking at the rushsendmail binary but I can't see how to issue
the whole command as one line without using an external file. This
will run on windows so I can't use the nix mail command.

	102.42 now comes with 'rushsendmail' on all platforms,
	but I don't recommend its use, as its interface and/or
	behavior might change in the future.

	However, for those curious, to use it from within perl
	would be something like:

#!/usr/bin/perl -w
my $from  = 'you@(email surpressed)';		# from address
my $to    = 'them@(email surpressed)';			# to address
my $relay = 'mail.yourdomain.com';		# your mail server or relay hostname
$ENV{RUSH_DIR} ||= ( -d "c:/rush" ? "c:/rush" : "/usr/local/rush" );
open(FD, "|$ENV{RUSH_DIR}/etc/bin/rushsendmail -r -t -s$relay -f$from");
print FD <<"EOF";
From: $from
To: $to
Reply-To: $from
Errors-To: $from
Return-Path: $from
Subject: something to say

Line one
Line two
end of message
EOF
close(FD);


--
Greg Ercolano, erco@(email surpressed)
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)
Cel: (Tel# suppressed)
Fax: (Tel# suppressed)