Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

(RhetTbull) Re: Mail modules on W2K

by RhetTbull (Curate)
on Feb 07, 2002 at 16:36 UTC ( #143910=note: print w/replies, xml ) Need Help??

in reply to Mail modules on W2K

I'm not sure what mail modules are available for Win32 but I routinely use something like this for sending email via Microsoft Outlook. It works well enough if all you need to do is send email from the account on your Win2K box. You'll need Win32::OLE.
sub send_outlook_mail { #use OLE and Outlook to send an email message my $to = shift || croak "required parameter (to address) missing"; my $subject = shift; $subject = "" if not defined $subject; my $body = shift; $body = "" if not defined $body; my $cc = shift; $cc = "" if not defined $cc; #get new Outlook instance my $mail = new Win32::OLE('Outlook.Application'); croak "Unable to start Outlook instance: $!" if !defined $mail; my $item = $mail->CreateItem(0); croak "Unable to create mail item: $!" if !defined $item; $item->{'To'} = $to; $item->{'CC'} = $cc; $item->{'Subject'} = $subject; $item->{'Body'} = $body; #rest of args are file attachments foreach my $attach (@ARGV) { # print STDERR "File attachment: $attach\n"; #make sure the attachment is really there croak "Missing attachment $attach: $!" if !-e $attach; my $attachments = $item->Attachments(); $attachments->Add($attach); } #send it $item->Send(); my $error = Win32::OLE->LastError(); carp "Win32::OLE error: $error" if $error; } #sub send_outlook_mail

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://143910]
[choroba]: just cherry pick the commits to a feature branch and reset/revert the master
[Corion]: choroba: Yeah - as this is not an official repository, I don't mind about ruining other peoples clones of that ;)
[choroba]: oh, if you already pushed, you should revert
[Corion]: choroba: Naah, I don't mind rewriting history, at least when it is in my favour ;)
[Corion]: Ruining other peoples clones is not nice, but as I only have that repo to (later) show people when I encounter problems, I don't mind that
[Corion]: I should look into self-hosting gitprep instead of relying so much on github

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (12)
As of 2017-01-23 10:30 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (192 votes). Check out past polls.