That is strange. I just ran your script and apart from complaing that my SMTP server doesnt relay mail, it worked.

It is strange that perl should be asking for sendmail on Windows, since it is a unix smtp mailer. What perl version are you using? ActivePerl, I assume?

This is what I use to send emails (no attachments though):
sub sendSMTPMail { # send a mail with SMTP server # parameters: # 0 : smtp (outgoing) mailserver # 1 : smtp user login # 2 : smtp user password # 3 : sender name # 4 : sender email # 5 : recipient email # 6 : message subject # 7 : email message my $server = shift; my $user = shift; my $pass = shift; my $sendername = shift; my $senderemail = shift; my $recipient = shift; my $subject = shift; my $message = shift; print "server:$server<br />\n"; print "user:$user<br />\n"; print "pass:$pass<br />\n"; print "sendername:$sendername<br />\n"; print "senderemail:$senderemail<br />\n"; print "recipient:$recipient<br />\n"; my $smtp = Net::SMTP->new($server); if ( $smtp ) { $smtp->auth("$user","$pass"); $smtp->mail("$senderemail"); $smtp->recipient($recipient); $smtp->data(); $smtp->datasend("To: $recipient\n"); $smtp->datasend("From: \"$sendername\" <$senderemail>\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n"); $smtp->datasend("$message\n"); $smtp->dataend(); $smtp->quit; } else { print "Could not contact smtp mail server $server\n"; } }

In reply to Re: emailing with attachments by jmagiera
in thread emailing with attachments 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.