Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Sending mail in windows

by kidd (Curate)
on Jul 11, 2002 at 05:11 UTC ( #180945=perlquestion: print w/replies, xml ) Need Help??
kidd has asked for the wisdom of the Perl Monks concerning the following question:


What function or what method do I have to use to send mails in windows?

I mean...I know that in UNIX you use sendmail with a script that looks something like this:

open (MAIL,"|/usr/lib/sendmail"); print MAIL "To: to\@e.mail\n"; print MAIL "From: from\@e.mail\n"; print MAIL "Subject: Subject\n\n"; print MAIL "Body\n"; close MAIL;

But how do you do it in a Windows platform?...

Replies are listed 'Best First'.
Re: Sending mail in windows
by DamnDirtyApe (Curate) on Jul 11, 2002 at 05:17 UTC

    The module I've had the most success with for sending mail is MIME::Lite. It will allow you to specify an SMTP server to use, rather than using sendmail.

    Update: Sample from the docs:

    $msg = MIME::Lite->new( From =>'', To =>'', Cc =>',', Subject =>'Helloooooo, nurse!', Data =>"How's it goin', eh?" ) ; ### Do something like this in your 'main': if ($I_DONT_HAVE_SENDMAIL) { MIME::Lite->send('smtp', "", Timeout => 60 ) ; } ### Now this will do the right thing: $msg->send; ### will now use Net::SMTP as shown above

    D a m n D i r t y A p e
    Home Node | Email
      Thanks for your reply...

      That is exactly what I was looking for...

Re: Sending mail in windows
by JayBonci (Curate) on Jul 11, 2002 at 08:17 UTC
    Again, more freedom is always good. Mail::Sender works very well, and supports attachments. It was originally written on windows, and works for that and linux/BSDs equally well.

Re: Sending mail in windows
by jdavidboyd (Friar) on Jul 11, 2002 at 09:28 UTC
    Mail::Sendmail works very well for me. I've used it in Windows with no problems.
      I also use Mail::Sendmail. Here's a snippet:

      use Mail::Sendmail; # Create the message hash my %mail = ( To => 'You <>', # To address.. From => 'Me <>', # From address.. Message => 'Hello, world!', # The message body.. Smtp => 'your.mail.server' # erase this if you want to use "loc +alhost" (default) ); # Send the message unless (sendmail(%mail)) { # Error! } # All is well.

Re: Sending mail in windows
by Theseus (Pilgrim) on Jul 11, 2002 at 14:04 UTC
    Mail::Sendmail has worked wonders for me, that's what I would recommend to anyone else who comes up against this problem. I don't even think I'll ever use sendmail on Unix again, Mail::Sendmail is just that easy.
      This work well with winNT... but not with win2000. I don't know why! <CODE>

      $sObjMail = Win32::OLE->new('PAINET.MAILMSG');



      $sObjMail->SetSubject("A mail");



Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://180945]
Approved by Courage
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2018-02-22 19:12 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (298 votes). Check out past polls.