PDA

View Full Version : send mail script


1freq
12-28-2004, 02:18 AM
Below is an error message I get when registering a new user with auction...Everysoft wrote the script

################################################## #
An e-mail was sent to mail@mail.com, this e-mail contains your password. The system cannot find the path specified.
################################################## #
Please look at following script and see if you know why sendmail does not work on windows 2000 server.....?????...Auction is registering new users....However sendmail is not working.....
################################################## #

sub sendemail {
my ($to,$from,$subject,$message) = @_;
my $trash;
if ($config{'mailhost'}) {
eval('use IO::Socket; 1;') or &oops("IO::Socket could not be loaded by the script. Please see the script documentation for details. It looks like this server is using perl version $]. IO::Socket may not be included with versions of perl prior to 5.00404."); # don't cause errors on machines where IO::Socket is not available
my $remote;
$remote = IO::Socket::INET->new("$config{'mailhost'}:smtp(25)");
$remote->autoflush();
print $remote "HELO\r\n";
$trash = <$remote>;
print $remote "MAIL From:<$config{'admin_address'}>\r\n";
$trash = <$remote>;
print $remote "RCPT To:<$to>\r\n";
$trash = <$remote>;
print $remote "DATA\r\n";
$trash = <$remote>;
print $remote "From: <$from>\r\nSubject: $subject\r\n\r\n";
print $remote $message;
print $remote "\r\n.\r\n";
$trash = <$remote>;
print $remote "QUIT\r\n";
}
else {
open MAIL, "|$config{'mailprog'}";
print MAIL "To: $to\r\nFrom: $from\r\nSubject: $subject\r\n\r\n$message\r\n\r\n";
close MAIL;
}
}


#################################################

Thanks Peaceful Days 1FREQ