Kbase P28320: How to send an e-mail with attachments using Outlook from the 4GL?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  23/03/2009 |
|
Status: Verified
GOAL:
How to send an e-mail with attachments using Outlook from the 4GL?
GOAL:
How to send emails via 4GL
FACT(s) (Environment):
Windows
Progress 8.x
Progress 9.x
OpenEdge 10.x
FIX:
The following code can be used as a sample.
DEFINE VARIABLE objOutlook AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE objOutlookMsg AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE objOutlookAttach AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE objOutlookRecip AS COM-HANDLE NO-UNDO.
CREATE "Outlook.Application" objOutlook.
objoutlookMsg = objOutlook:CreateItem(0).
objOutlookRecip = objOutlookMsg:Recipients:Add("youremail@yourmailserver.com").
objOutlookRecip:Type = 1.
objOutlookMsg:Subject = "Your Subject".
objOutlookMsg:Body = "The Body".
objOutlookMsg:Attachments:Add("c:\autoexec.bat").
objOutlookRecip:Resolve.
objOutlookMsg:Send.
objoutlook:Quit().
RELEASE OBJECT objOutlook.
RELEASE OBJECT objOutlookMsg.
RELEASE OBJECT objOutlookRecip.