xHarbour Builder + FivewinH with Outlook Office 2003
Posted: Mon Sep 04, 2006 2:11 pm
Hello forum,
The following code work *BUT*
BUT if I did cancel, before to send the email, the following message show:
BUT if I try to destroy all the created OLE objects, also get ERRORS
Some ideas programmers fellows and friends?
I am using FWH 2.7 Aug_06, xHarbour Builder RC9 Aug_06 and Ms-Office 2003
Beside, I would like to know if your are using or used in the past, BLAT.DLL, (or BLAT.EXE command line) to send emails, and how is your experience with it.
Regards
George
The following code work *BUT*
Code: Select all
FUNCTION SendEmailByOutLook (cReportName) //Using Ole
LOCAL oOutLook,;
oMailItem,;
oRecip,;
oAttach
/* creating the OLE object */
oOutLook := TOleAuto():New("Outlook.Application")
/* creating a Mail Item object*/
oMailItem := oOutLook:Invoke("CreateItem", 0)
// creating Recipients object and attaching addresses
oRecip := oMailItem:Invoke("Recipients")
oRecip:Invoke("Add", "my_email_address@msn.com")
/* creating subject and body of the mail message using the
SET method of the mail item object */
oMailItem:Set("Subject", "Sending an e-mail with Outlook")
oMailItem:Set("Body", "Email test using outlook"+CRLF+CRLF)
/* creating an Attachment object and adding files to send */
oAttach := oMailItem:Invoke("Attachments")
oAttach:Invoke("Add", cReportName)
//oMailItem:Display(.T.)
/* Mail message created, now send the full featured message*/
oMailItem:Invoke("Send")
/* Destroy all the created OLE objects
oRecip:End()
oAttach:End()
oMailItem:End()
oOutLook:End()
*/
/* done */
MsgInfo("Email Message sent")
BUT if I did cancel, before to send the email, the following message show:
Code: Select all
Time from start: 0 hours 1 mins 31 secs
Error occurred at: 09/04/2006, 09:52:21
Error description: Error Outlook.Application:CREATEITEM/16389 E_FAIL: RECIPIENTS
Args:
Stack Calls
===========
Called from: win32ole.prg => TOLEAUTO:RECIPIENTS(0)
Called from: => HB_EXECFROMARRAY(0)
Called from: win32ole.prg => TOLEAUTO:INVOKE(415)
Called from: rpreview0.prg => SENDEMAILBYOUTLOOK(2069)
BUT if I try to destroy all the created OLE objects, also get ERRORS
Some ideas programmers fellows and friends?
I am using FWH 2.7 Aug_06, xHarbour Builder RC9 Aug_06 and Ms-Office 2003
Beside, I would like to know if your are using or used in the past, BLAT.DLL, (or BLAT.EXE command line) to send emails, and how is your experience with it.
Regards
George