Jump to content

OutlookEX UDF - Help & Support


Recommended Posts

IIRC the signature is appended when you actually send the mail. Can you try to send the mail to yourself?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

IIRC the signature is appended when you actually send the mail. Can you try to send the mail to yourself?

; Script Start - Add your code below here
#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
#include <OutlookEX.au3>

$iOL_Debug = 2
Global $oOutlook = _OL_Open()
Global $sCurrentUser = "testsig@inbox.com"
_OL_Wrapper_SendMail($oOutlook, $sCurrentUser, "", "", "TestSubject", "Body<br><b>fett</b> normal.", @ScriptDir & "_OL_Wrapper_SendMail.au3", $olFormatHTML, $olImportanceHigh)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OutlookSendMail Wrapper Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)
MsgBox(64, "OutlookEX UDF: _OutlookSendMail Wrapper Script", "Mail successfully sent to user '" & $sCurrentUser & "'!")

I want to avoid any mis-config or mis-setting so direct copy and paste of default sendmail func. yield email successfully sent without signature.

Edited by Crayfish
Link to comment
Share on other sites

Can you please post the output of function _OL_MaiLSignatureGet.au3?

NB: Which version of Outlook do you run on which operating system?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Can you please post the output of function _OL_MaiLSignatureGet.au3?

NB: Which version of Outlook do you run on which operating system?

[0]|1|3|

[1]|Outlook-UDF-Test|True|True

Posted Image

I tried all different thing with calling different func. There is no possible way to get signature to include with email from outlookEX. Do you have a prescript that actually attach signature to the email?

Link to comment
Share on other sites

I think it could be a bug in the OutlookEX functions. Will have to test ...

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

It's not a bug - it's a bit more complex.

The signature is added to the mail - but overwritten as soon as you add your text to the mail. Therefore you need to read the text of the mail jsut containing the signature, add your text and rewrite.

As this can't be done using the _OL_ItemCreate function you need to do it yourself. Attached you'll find 3 examples for text, html and RTF mails.

It would be possible to change function _OL_ItemCreate a bit but you still would have to do the text related stuff outside the function.

;=====
; HTML
;=====
$oItem = _OL_ItemCreate($oOutlook, $olMailItem, $oSourceFolderMail, "", "Subject=TestMail", "To=" & $sOL_CurrentUser)
$oItem.BodyFormat = $olFormatHTML
$sBody = $oItem.HTMLBody
$oItem.HTMLBody = "[b]Mail[/b] Text" & $sBody
$oItem.Display

OL_Test2.au3

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hi Water,

Thank you for pointing out where I think it is outlook design by default to append signature before hand. I do notice your example is completely OutlookEX independant. I just want a simple mail send with signature. I have learn much and Water you are a tremendous helpful.

#include <GUIConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Local $olMailItem    = 0
Local $olFormatHTML = 2
Local $olFormatRichText = 3
Local $olImportanceLow   = 0
Local $olImportanceNormal= 1
Local $olImportanceHigh  = 2
;=====
; HTML
;=====
$oOApp = ObjCreate("Outlook.Application")
$oItem = $oOApp.CreateItem($olMailItem)

$oItem.BodyFormat = $olFormatHTML
$oItem.GetInspector
$sSignature = $oItem.HTMLBody
$oItem.Importance = $olImportanceHigh
$oItem.HTMLBody = "<span style=font-family:Calibri;font-size:11pt>" & _
                "The files in Directory" & _
                "<p>" & _DateTimeFormat(_DateAdd('d',+1, _NowCalcDate()),1) & " " & _Time() & _
             "<br>" & @CRLF  & $sSignature
$oItem.Subject = "Subject"
$oItem.Display

Func _Time()
    Local $hour = @HOUR, $AMPM = "AM"
    If $hour > 11 Then $AMPM = "PM"
    If $hour = 0 Then $hour = 12
    If $hour > 12 Then $hour -= 12
    Return $hour & ":" & @MIN & " " & $AMPM
EndFunc ;==>_Time
Link to comment
Share on other sites

Glad you got it working :D

I will change the _OL_ItemCreate function so users can have a signature in their OutlookEX based solution as well.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Attached you'll find two new functions:

  • _OL_RecipientCheck: Checks one/more recipients to be valid. Returns a two dimensional array with information about each recipient (resolved, mail address etc.)
  • _OL_ItemRecipientSelect: Displays the Recipient Selection Dialog and returns the selected recipients
So you can pass any unresolved recipients returned by _OL_RecipientCheck to _OL_ItemRecipientSelect and let the user select a valid recipient which then can be further processed by your script.

Hi Water

I have the following code

Global $oRecipSelect = _OL_ItemRecipientSelect($oOutlook, "", $olTo)
_ArrayDisplay($oRecipSelect, "$oRecipSelect Array")
_OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olTo, $oRecipSelect[0])

Unfortunately _ArrayDisplay($oRecipSelect, "$oRecipSelect Array") returns nothing in the array, even if there is only one name that matches the search criteria in the address book. Do I have a problem with my code or is this a bug?

Link to comment
Share on other sites

That's fine. Because the function returns a "zero based one-dimensional array with the recipient objects of the selected recipients." _ArrayDisplay can't display objects.

If @error = 0 after you called the function then everything is fine.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

sorry about that water (showing my inexperience there).

I'm still having trouble getting the recipient to resolve correctly however.

I can get the unresolved recipient to pass successfully to _OL_ItemRecipientSelect but even when I select the name from the address book it doesn't resolve in to the mail item (i.e. the name is not underlined). This is my code - can you see what i'm doing wrong?

Global $stringSendTo = StringSplit($acceptanceArray[$i][9], "(", 2)
Global $oRecipCheck = _OL_ItemRecipientCheck($oOutlook, $stringSendTo[0])
If $oRecipCheck[1][1] = "True" Then
   _OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olTo, StringStripWS($stringSendTo[0], 2))
   ; Send the mail item
   _OL_ItemSend($oOutlook, $oItem)
   If @error <> 0 Then MsgBox(16, "Error", "Error sending the mail item. @error = " & @error & ", @extended = " & @extended)
Else
   Opt("WinTitleMatchMode", 2)
   WinActivate("Microsoft Outlook")
   WinWaitActive("Microsoft Outlook")
   $oItem.Display
   Global $oRecipSelect = _OL_ItemRecipientSelect($oOutlook, StringStripWS($stringSendTo[0], 2), $olTo, True)
   If @error <> 0 Then MsgBox(16, "Error", "Error selecting the recipient. @error = " & @error & ", @extended = " & @extended)
   _OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olTo, $oRecipSelect)
   If @error <> 0 Then MsgBox(16, "Error", "Error adding the recipient. @error = " & @error & ", @extended = " & @extended)
   ; Send the mail item
   _OL_ItemSend($oOutlook, $oItem)
   If @error <> 0 Then MsgBox(16, "Error", "Error sending the mail item. @error = " & @error & ", @extended = " & @extended)
EndIf
Edited by mdcastle
Link to comment
Share on other sites

Change

_OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olTo, $oRecipSelect)
to
_OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olTo, $oRecipSelect[0])
because _OL_ItemRecipientAdd returns an array.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I just tested and it works fine here. Can you please add line

$iOL_Debug = 2
after the #include line so we can see what the error code means?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

scriptline: 3470

NumberHex: 80020009

Number: -2147352567

Description: Outlook does not recognize one or more names

I get this even after the name is resolved in the address picker. When the address picker closes the name in to 'To' field goes back to being unresolved. The same result occurs if I pass

Global $oRecipSelect = _OL_ItemRecipientSelect($oOutlook, StringStripWS($stringSendTo[0], 2), $olTo, True)
or
Global $oRecipSelect = _OL_ItemRecipientSelect($oOutlook, "", $olTo, True)
Edited by mdcastle
Link to comment
Share on other sites

Did I ask you which Outlook version you use?

Can you please post line 3470?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Outlook 2010

I'm not sure what line 3470 is, as my script only has 538 lines. Are the other lines the includes? I've got IE.au3, Date.au3, Excel.au3 and OutlookEx.au3. Is there another way to get what is being called on line 3470?

Link to comment
Share on other sites

I will create a small reproducer script so it will be easier to identify the problem.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Here is the reproducer. Insert a valid or invalid address and it should send the mail as soon as all recipients are correct.

A bit complext - but I will have a look and hope to make it a bit easier:

#include <OutlookEX.au3>

Global $stringSendTo = "valid address or invalid address"
Global $bInvalidRecipients = True, $aRecipCheck, $oRecipSelect
$oOutlook = _OL_Open()
$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "*\Outlook-UDF-Test\TargetFolder\Mail", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML, "HTMLBody=Bodytext in <b>bold</b>")
If @error <> 0 Then Exit MsgBox(16, "Error", "Error returned by _OL_ItemCreate. @error = " & @error & ", @extended = " & @extended)
$aRecipCheck = _OL_ItemRecipientCheckEX($oOutlook, $stringSendTo)
$bInvalidRecipients = False
For $i = 1 To $aRecipCheck[0][0]
If $aRecipCheck[$i][1] = False Then $bInvalidRecipients = True
Next
If $bInvalidRecipients Then
$oItem.Display
$oRecipSelect = _OL_ItemRecipientSelect($oOutlook, $stringSendTo, $olTo, True)
If Not IsArray($oRecipSelect) Then Exit
If @error <> 0 Then Exit MsgBox(16, "Error", "Error returned by _OL_ItemRecipientSelect. @error = " & @error & ", @extended = " & @extended)
_OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olTo, $oRecipSelect)
If @error <> 0 Then Exit MsgBox(16, "Error", "Error returned by _OL_RecipientAdd. @error = " & @error & ", @extended = " & @extended)
Else
For $i = 1 To $aRecipCheck[0][0]
_OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olTo, $aRecipCheck[$i][2])
If @error <> 0 Then Exit MsgBox(16, "Error", "Error returned by _OL_RecipientAdd. @error = " & @error & ", @extended = " & @extended)
Next
EndIf
_OL_ItemSend($oOutlook, $oItem)
If @error <> 0 Then Exit MsgBox(16, "Error", "Error returned by _OL_ItemSend. @error = " & @error & ", @extended = " & @extended)
_OL_Close($oOutlook)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hi Water,

Firstly let me say you have done a great job with this UDF. You have gone to a lot of trouble.

I'm trying to use the wraper to send an email and I'm getting a strange error from within the include file.

Here are the lines of code to create the email.

$oOL = _OL_Open()

_OL_Wrapper_SendMail($oOL, $guiControlArray[$p][$EmailAddress], "", "", $clipboard, "", $olFormatHTML, $olImportanceNormal)

I believe all those varables are set correctly.

When I execute the script I receive the follwoing message.

C:\Local\ChangeOfAddress\OutlookEX.au3 (983) : ==> Variable must be of type "Object".:

Local $oOL_Namespace = $oOL.GetNamespace("MAPI")

Local $oOL_Namespace = $oOL^ ERROR

->12:01:28 AutoIT3.exe ended.rc:1

Google didn't hlep me. :(

Any ideas where I'm going wrong.

Thanks in advance

David

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...