Consultor Eletrônico



Kbase P167792: How to send email using a Microsoft Outlook Com object?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/1/2010
Status: Unverified

GOAL:

How to send email using a Microsoft Outlook Com object?

GOAL:

Can I send email from ABL using Outlook?

FACT(s) (Environment):

OpenEdge 10.x
Progress 9.x
Windows

FIX:

Sample code to send email using Microsoft Outlook COM object:
DEFINE VARIABLE olApp AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE olNS AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE olMail AS COM-HANDLE NO-UNDO.

CREATE "Outlook.Application" olApp.
olNS = olApp:GetNamespace( "MAPI" ).
olNS:Logon().
olMail = olApp:CreateItem( 0 ).
olMail:TO = "myaddress@mycompany.com".
olMail:Subject = "Subject here".
olMail:Body = "Body Here.".
olMail:SEND().

MESSAGE "All Done ..." VIEW-AS ALERT-BOX.

olNS:Logoff().

RELEASE OBJECT olNS.
RELEASE OBJECT olMail.
RELEASE OBJECT olApp.