Error occurred while accessing component property method:send. Operation aborted.

deivaa.dhayalan

New Member
Hello,

In our application i am using the below code for sending email for alert purpose.


/* Email Alert*/

DEFINE VAR vOfficeHandle AS COM-HANDLE NO-UNDO.
DEFINE VAR vObjoutlookMsg AS COM-HANDLE NO-UNDO.

CREATE "Outlook.Application" vOfficeHandle.
vObjoutlookMsg = vOfficeHandle:CreateItem(0).

ASSIGN
vObjoutlookMsg:To = 'Your_Name@Your_Domain.com'
vObjoutlookMsg:Subject = 'Test Mail for Outlook'
vObjoutlookMsg:Body = 'Hai BDC, This is Test Mail '.

vObjoutlookMsg:SAVE().
vObjoutlookMsg:Send().


RELEASE OBJECT vOfficeHandle.
RELEASE OBJECT vObjoutlookMsg.

/* Email Alert*/


Whenever I open MS Outlook, the above program is working fine. But When I close Outlook and execute the same program giving an Error.

"Error occurred while accessing component property method send. Operation aborted Error 0x80004004".

Please some one help me to solve this issue,


Thanks in Advance,

Deivanayaga Perumal D.
 

Attachments

  • Error.jpg
    Error.jpg
    28.5 KB · Views: 26

RealHeavyDude

Well-Known Member
The only solution is to make sure that Outlook is running when you are trying to access via the automation object. OLE Automation is not my strength so please bear with me. Something like this ( courtesy of the not so easy to reach knowledge base )
EnvironmentOpenEdge 10.xProgress 9.xWindows

Question/Problem Description
How to send email using a Microsoft Outlook Com object?
Can I send email from ABL using Outlook?



Error Message



Defect Number



Cause




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



Workaround




Notes
References to Written Documentation:
Microsoft Knowledge Base 220595
http://support.microsoft.com/kb/220595
should do.

Heavy Regards, RealHeavyDude.
 
Top