Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

How do I send E-mail via the Microsoft exchange server?

by Roger (Parson)
on Sep 26, 2003 at 03:41 UTC ( [id://294326]=perlquestion: print w/replies, xml ) Need Help??

Roger has asked for the wisdom of the Perl Monks concerning the following question: (mail and news)

How do I send E-mail via the Microsoft exchange server?

Originally posted as a Categorized Question.

  • Comment on How do I send E-mail via the Microsoft exchange server?

Replies are listed 'Best First'.
Re: How do I send E-mail via Microsoft exchange server from my Perl Program?
by Roger (Parson) on Sep 26, 2003 at 07:01 UTC
    To send E-mail via the Microsoft exchange server, you need to use the MAPI interface. I have created an example below to send Email via exchange server:

    use Win32::OLE; use strict; # Create a new MAPI session my $session = Win32::OLE->new("MAPI.Session") or die "Failed to create a new MAPI Session!"; # Logon to server my $res = $session->Logon("roger", "letmepass"); die "Could not log on to exchange server!" if ($res); # Create a new message my $msg = $session->Outbox->Messages->Add(); # Add the recipient and resolve the address my $recipient = $msg->Recipients->Add(); $recipient->{Name} = "someone@somewhere.com"; $recipient->Resolve(); # Add your text $msg->{Subject} = "Email Test"; $msg->{Text} = qq/ Email test .... will this work? Regards Roger /; # Send the email $msg->Update(); $msg->Send(0, 0, 0); # Log off $session->Logoff();

      OK... cool... then, how do you add an attachment? --lnl

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-19 20:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found