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.


In reply to Re: sendmail on windows- unique location by antirice
in thread sendmail on windows- unique location by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.