For sending mail from multi-platforms (such as using a Windows 2000 Professional machine for testing, moving the code to Windows 2000 Advanced Server and then to a Linux box), I tend to use Mime::Lite. It's available via Activestate PPM (so it's extremely easy to install on a Windows machine), you can configure it to either Sendmail (if you've got it installed) or connect directly to your mail server, you can add 'attachments' and it's got plenty of example code for you to examine and try - one of the simplist ways that I use it is:

use Mime::Lite MIME::Lite->send('smtp', $mail_server_name_or_ip_address, TimeOut=>60) +; my $msg=MIME::Lite->new ( From=>"$from_name <$from_email_address>", To =>"$to_email_address", Subject=>"$subject_of_email", Type=>'text', Data=>$body_of_email ); $msg->send;

There is also Mail::Sender and Net::SMTP for you to consider. An example of Net::SMTP code is:

use Net::SMTP my $smtp=Net::SMTP->new($mailserver_name_or_ip_address); $smtp->mail($from_address); $smtp->to($to_address); $smtp->data(); $smtp->datasend("To: $to_address\n"); $smtp->datasend("From: $from_address\n"); $smtp->datasend("Subject: $message_subject\n"); $smtp->datasend("\n$body_of_email\n"); $smtp->dataend(); $smtp->quit;


In reply to Re: Mail modules on W2K by beebware
in thread Mail modules on W2K by Zo

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.