Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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:

Hello...

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?...

Comment on Sending mail in windows
Select or Download Code
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 =>'me@myhost.com', To =>'you@yourhost.com', Cc =>'some@other.com, some@more.com', 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', "smtp.myisp.net", 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.

        --jb
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 <your@address.com>', # To address.. From => 'Me <my@address.com>', # 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.

      -Brian
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->SetFrom("From\@me");

      $sObjMail->AddTo("To\@you");

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

      $sObjMail->SetBody("Hello");

      $sObjMail->Deliver();

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://180945]
Approved by Courage
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-08-31 10:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls