Hmmm, I just tried using that sendmail program with Mail::Mailer and finally got it to work. Please note that getting it to work isn't easy and requires you to edit Mail::Mailer's source to get it to work properly on windows. Also, please be certain that your perl is 5.6.1 or later.
First, here's my test script:
#!/usr/bin/perl -l
BEGIN { $ENV{'PERL_MAILERS'} = 'sendmail:c:\sendmail.exe'; }
use Mail::Mailer "sendmail";
my $m = Mail::Mailer->new();
$m->open({qw(
From someone@somewhere.com
To someone@someotherplace.com
Subject hey
)}
);
print $m "Hi";
$m->close;
Please make certain you're putting '.exe' at the end of the executable or it'll complain that it can't find the executable. Now we have to work around a problem with Mail::Mailer. Unfortunately, it uses open($self,"|-") which, if you've read perldoc perlfork, isn't implemented on windows yet. However, there's a workaround. You'll need to add the following code to Mail::Mailer's source (preferably towards the end):
sub pipe_to_fork {
my $parent = shift;
pipe my $child, $parent or die;
my $pid = fork();
die "fork() failed: $!" unless defined $pid;
if ($pid) {
close $child;
}
else {
close $parent;
open(STDIN, "<&=" . fileno($child)) or die;
}
$pid;
}
You will then need to go to line 269 and change open($self,"|-") to pipe_to_fork($self).
Once you've done that, it should work. If it doesn't please reply below. |