Sign in to follow this  
Followers 0

OutlookEX UDF - Help & Support

635 posts in this topic

Posted (edited)

This is the "General Help and Support" thread for the Extended Outlook UDF (OutlookEX).

The UDF itself can be downloaded here (please see my signature below).

So if you have any questions, suggestions or errors please post here.

Edited by water

Share this post


Link to post
Share on other sites



Posted

Hi Water,

I am trying to send an email to particular ID by using "Outlook.au3" - _outlooksendemail() function. But i am ending up with an error message Error occured during the "Objevent". The error value returns as "9". Do you have any suggestion for me please ?

Share this post


Link to post
Share on other sites

Posted (edited)

Hi Syed,

Did you call _OutlookOpen() as first statement?

Is Outlook installed on the machine?

Edited by water

Share this post


Link to post
Share on other sites

Posted

Hi Syed,

Did you call _OutlookOpen() as first statement?

Is Outlook installed on the machine?

yeah.. I do water. Please see the below code! Also Outlook is present on that machine, Office 2007.

#include<Outlook.au3>

#include<File.au3>

$ooutlook = _OutlookOpen()

_OutlookSendMail($oOutlook, "winningmoment_syed@yahoo.co.in","","", "GD Core Application Checker tool Feedback", $TextBody,$attachemnt,"Tahoma")

If @error Then

_FileWriteLog(@DesktopDir&"\outlook.log","Error > Mail Process >"&"Uanble to send an email.Error occured during the mail process.Error value is "&@error)

MsgBox(64,"Error Message","Error Occured while sending an email")

EndIf

Share this post


Link to post
Share on other sites

Posted (edited)

Please replace the last parameter of _OutlookSendMail. "Tahoma" is no an valid entry.

You can just use $olFormatHTML, $olFormatPlain, $olFormatRichText, $olFormatUnspecified to specify the format of the body.

Edit:

Or if you like you can use OutlookEX, the successor of the Outlook UDF.

OutlookEX has more functions, better error handling ...

We have even written "wrapper" functions so migration from Outlook to OutlookEX is much easier.

If you like I can post the code.

Edited by water

Share this post


Link to post
Share on other sites

Posted

Please replace the last parameter of _OutlookSendMail. "Tahoma" is no an valid entry.

You can just use $olFormatHTML, $olFormatPlain, $olFormatRichText, $olFormatUnspecified to specify the format of the body.

even i tried with the below code! still the result same! :)

#include<Outlook.au3>

#include<File.au3>

$ooutlook = _OutlookOpen()

_OutlookSendMail($oOutlook, "winningmoment_syed@yahoo.co.in","","", "GD Core Application Checker tool Feedback", $TextBody,$attachemnt)

If @error Then

_FileWriteLog(@DesktopDir&"\outlook.log","Error > Mail Process >"&"Uanble to send an email.Error occured during the mail process.Error value is "&@error)

MsgBox(64,"Error Message","Error Occured while sending an email")

EndIf

Share this post


Link to post
Share on other sites

Posted (edited)

Isn't there a typo in "$attachemnt"? Shouldn't it read "$attachment"?

BTW: There is an enhanced Outlook UDF available - please see my previous post.

Edited by water

Share this post


Link to post
Share on other sites

Posted

Isn't there a type in "$attachemnt"? Shouldn't it read "$attachment"?

BTW: There is an enhanced Outlook UDF available - please see my previous post.

for the varible $attachemnt i have declared properly. Please see the below 2 two options what i have tried. But the result where same :). sorry for this late reply

#include <OutlookEX.au3>

Global $oOutlook = _OL_Open()

; *****************************************************************************

; Example 1

; Send an html mail to the current user.

; Add an attachment and set importance to high.

; *****************************************************************************

Global $sCurrentUser = $oOutlook.GetNameSpace("MAPI").CurrentUser.Name

_OL_MailSend($oOutlook, "TestSubject", "Body<br><b>fett</b> normal.", $sCurrentUser, @ScriptDir & "\_OL_MailSend.au3", $olImportanceHigh, $olFormatHTML)

If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_MailSend Example Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)

MsgBox(64, "OutlookEX UDF: _OL_MailSend Example Script", "Mail successfully sent to user '" & $sCurrentUser & "'!")

; *****************************************************************************

; Example 2

; *****************************************************************************

#include<Outlook.au3>

#include<File.au3>

$attachemnt = "C:\temp\report.html"

$TextBody = "does it works without any issue?"

$oOutlook= _OutlookOpen()

_OutlookSendMail($oOutlook, "winningmoment_syed@yahoo.co.in","","", "GD Core Application Checker tool Feedback", $TextBody,$attachemnt)

If @error Then

_FileWriteLog(@DesktopDir&"\outlook.log","Error > Mail Process >"&"Uanble to send an email.Error occured during the mail process.Error value is "&@error)

MsgBox(64,"Error Message","Error Occured while sending an email")

EndIf

Share this post


Link to post
Share on other sites

Posted

Could you please run the following script? I inserted one line (denoted by <==) which should give us better error messages. Could you please post the pop up you get?

#include <OutlookEX.au3>

Global $oOutlook = _OL_Open()
$iOL_Debug = 2  ; <== Insert this line
; *****************************************************************************
; Example 1
; Send an html mail to the current user.
; Add an attachment and set importance to high.
; *****************************************************************************
Global $sCurrentUser = $oOutlook.GetNameSpace("MAPI").CurrentUser.Name
_OL_MailSend($oOutlook, "TestSubject", "Body<br><b>fett</b> normal.", $sCurrentUser, @ScriptDir & "\_OL_MailSend.au3", $olImportanceHigh, $olFormatHTML)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_MailSend Example Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)
MsgBox(64, "OutlookEX UDF: _OL_MailSend Example Script", "Mail successfully sent to user '" & $sCurrentUser & "'!")

Share this post


Link to post
Share on other sites

Posted

Could you please run the following script? I inserted one line (denoted by <==) which should give us better error messages. Could you please post the pop up you get?

#include <OutlookEX.au3>

Global $oOutlook = _OL_Open()
$iOL_Debug = 2     ; <== Insert this line
; *****************************************************************************
; Example 1
; Send an html mail to the current user.
; Add an attachment and set importance to high.
; *****************************************************************************
Global $sCurrentUser = $oOutlook.GetNameSpace("MAPI").CurrentUser.Name
_OL_MailSend($oOutlook, "TestSubject", "Body<br><b>fett</b> normal.", $sCurrentUser, @ScriptDir & "\_OL_MailSend.au3", $olImportanceHigh, $olFormatHTML)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_MailSend Example Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)
MsgBox(64, "OutlookEX UDF: _OL_MailSend Example Script", "Mail successfully sent to user '" & $sCurrentUser & "'!")

yeah..i gave a try and got below message!

Share this post


Link to post
Share on other sites

Posted

Mmmm ... "operation aborted" can be everything.

What operating system do you run?

What version of Outlook do you use?

Share this post


Link to post
Share on other sites

Posted (edited)

Scriptline 10 seems to be the line before _OL_MailSend.

Could you please run this - modified - version? We try to catch the error as soon as possible.

#include <OutlookEX.au3>
$iOL_Debug = 2  ; <==This line has been moved
Global $oOutlook = _OL_Open()

; *****************************************************************************
; Example 1
; Send an html mail to the current user.
; Add an attachment and set importance to high.
; *****************************************************************************
Global $sCurrentUser = $oOutlook.GetNameSpace("MAPI").CurrentUser.Name
_OL_MailSend($oOutlook, "TestSubject", "Body<br><b>fett</b> normal.", $sCurrentUser, @ScriptDir & "\_OL_MailSend.au3", $olImportanceHigh, $olFormatHTML)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_MailSend Example Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)
MsgBox(64, "OutlookEX UDF: _OL_MailSend Example Script", "Mail successfully sent to user '" & $sCurrentUser & "'!")
Edited by water

Share this post


Link to post
Share on other sites

Posted (edited)

Scriptline 10 seems to be the line before _OL_MailSend.

Could you please run this - modified - version? We try to catch the error as soon as possible.

#include <OutlookEX.au3>
$iOL_Debug = 2     ; <==This line has been moved
Global $oOutlook = _OL_Open()

; *****************************************************************************
; Example 1
; Send an html mail to the current user.
; Add an attachment and set importance to high.
; *****************************************************************************
Global $sCurrentUser = $oOutlook.GetNameSpace("MAPI").CurrentUser.Name
_OL_MailSend($oOutlook, "TestSubject", "Body<br><b>fett</b> normal.", $sCurrentUser, @ScriptDir & "\_OL_MailSend.au3", $olImportanceHigh, $olFormatHTML)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_MailSend Example Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)
MsgBox(64, "OutlookEX UDF: _OL_MailSend Example Script", "Mail successfully sent to user '" & $sCurrentUser & "'!")

The modified script works fine only if i have opened the outlook during the script execution orelse the below messages are getting prompted.please let me know if i follow anything wrong. Edited by Syed23

Share this post


Link to post
Share on other sites

Posted

Same problem here. It runs fine when Outlook is running. But crashes with the same error messages you get if Outlook is not up and running.

I'll have to investigate this problem.

Share this post


Link to post
Share on other sites

Posted

Hi Syed,

I've been searching the internet high and low but couldn't find a solution.

It seems as if ObjCreate starts up Outlook and returns to your script before the COM interface is up and running. It looks as if Outlook does some of the startup asynchroniously.

The only solution I have so far is to put a Sleep(1000) - or more - after _OL_Open().

Share this post


Link to post
Share on other sites

Posted

Hi Syed,

I've been searching the internet high and low but couldn't find a solution.

It seems as if ObjCreate starts up Outlook and returns to your script before the COM interface is up and running. It looks as if Outlook does some of the startup asynchroniously.

The only solution I have so far is to put a Sleep(1000) - or more - after _OL_Open().

hmmm... Thanks for your research on it Water.Currently i am vaccation.Once i get in to work i will test it and let you know the solution.

Note:

On Windows machine i am getting the same error message even if i have opened the outlook during the script execution. Shall i try the same solution on Windows 7 too ?

Anyway Thanks a lot and i will let you know the results!

Share this post


Link to post
Share on other sites

Posted (edited)

Hi Syed,

I've tested on Windows XP SP3 with Outlook 2002 and on Windows 7 SP1 with Outlook 2010.

On both machines Windows 7 with Outlook 2010 it works when Outlook is already running and doesn't if I don't wait for Outlook to come up.

Edit:

On Windows XP SP3 with Outlook 2002 it doesn't matter if Outlook is running or not - _OL_MailSend always works.

Edited by water

Share this post


Link to post
Share on other sites

Posted

Version 0.0.3 has been released.

Please test before using in production!

For download please see my signature.

Share this post


Link to post
Share on other sites

Posted

Seems to work well however if I loop the ItemFind function I get this if I don't put timed delay between the commands:

OutlookEX.au3 (1831) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$aOL_Items[$iOL_Counter][$iOL_Index - 1] = $oOL_Item.ItemProperties.Item($aOL_ReturnProperties[$iOL_Index] ).value

^ ERROR

Works fine if I pause for a couple of seconds after each call.

Any ideas? Since I don't directly see a flaw in your code to cause it.

Share this post


Link to post
Share on other sites

Posted

Hi Autobot,

put a Sleep for a few seconds (>10) after _OL_Open and see if the problem persists.

In addition you can set $iOL_Debug = 2 before _OL_Open.

If you get 0x80004004 (Operation aborted) you have the same problem we are investigating at the moment.

What Windows do you run, what Outllok do you run?

Share this post


Link to post
Share on other sites
This topic is now closed to further replies.
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.