Jump to content

Recommended Posts

Posted

Adding to my post above, I wanted to post debug info that I just learned how to get while going back pages on this post.
This is not the case if only my personal account is configured. or only one account is configured. The email gets sent out graciously using _OL_Wrapper_SendMail.

error.png

Posted

When calling _OL_Open set parameter $sProfileName to the profile needed.

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

 

Posted
2 hours ago, water said:

When calling _OL_Open set parameter $sProfileName to the profile needed.

I apologize for not descriptive enough. I mean if 2 or more email accounts are configured under same email profile, only then this error happens. I have only one outlook profile. Alternatively, I also tried sending a mail like this:
 _OL_Open()
$oitem = _OL_ItemCreate($outlook, $olMailItem,"*","", "Subject=TestMail", "BodyFormat=" & $olFormatHTML)
    $oitem = _OL_itemAttachmentAdd($outlook, $oitem, Default, $logFile)
    $oitem = _OL_ItemRecipientAdd($outlook,$oitem, Default, 1, $defaultmail)
    $oitem = _OL_ItemRecipientAdd($outlook, $oitem, Default, 2, $mail)
    $oitem = _OL_ItemModify($outlook, $oitem, Default, "Body=Test")
    _OL_ItemSend($outlook, $oitem,Default)
_OL_Close()

Only to run into attached error. What did go wrong here?

I really appreciate your help, water. All I am trying to do is send an email notifying task completed to two email addresses.

error.png

Posted
5 minutes ago, vindicta said:

And oddly enough, I just realized that error from my previous post (using _OL_Wrapper_SendMail) is the same as creating an email part by part.

That's expected. The wrapper function does the same - it calls function by function like you did.

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

 

Posted

The error message you get tells us that Outlook was not able to resolve a recipient.
If you manually create a mail and enter the recipient and let Outlook resolve the address, does Outlook present a list of recipients you need to select from?

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

 

Posted
1 minute ago, water said:

The error message you get tells us that Outlook was not able to resolve a recipient.
If you manually create a mail and enter the recipient and let Outlook resolve the address, does Outlook present a list of recipients you need to select from?

On manually entering names/email addresses in a new email, outlook automatically resolves them

Posted (edited)

What do you get if you run this stripped down version (after modifying the marked line)?

#include "OutlookEX.au3"
Global $oOL = _OL_Open()
Global $sDefaultMail = "Recipient 1", $sMail = "Recipient 2", $sLogFile = @ScriptDir & "\Test.log" ; <=== MODIFY
$oItem = _OL_ItemCreate($oOL, $olMailItem, "", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML, "Body=Test")
ConsoleWrite("_OL_ItemCreate:        @error = " & @error & ", @extended = " & @extended & @CRLF)
_OL_ItemAttachmentAdd($oOL, $oItem, Default, $sLogFile)
ConsoleWrite("_OL_ItemAttachmentAdd: @error = " & @error & ", @extended = " & @extended & @CRLF)
_OL_ItemRecipientAdd($oOL, $oItem, Default, 1, $sDefaultMail)
ConsoleWrite("_OL_ItemRecipientAdd1: @error = " & @error & ", @extended = " & @extended & @CRLF)
_OL_ItemRecipientAdd($oOL, $oItem, Default, 2, $sMail)
ConsoleWrite("_OL_ItemRecipientAdd2: @error = " & @error & ", @extended = " & @extended & @CRLF)
_OL_ItemSend($oOL, $oItem, Default)
ConsoleWrite("_OL_ItemSend:          @error = " & @error & ", @extended = " & @extended & @CRLF)
_OL_Close($oOL)
ConsoleWrite("_OL_Close:             @error = " & @error & ", @extended = " & @extended & @CRLF)

 

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

 

Posted
_OL_ItemCreate:        @error = 0, @extended = 0
_OL_ItemAttachmentAdd: @error = 0, @extended = 0
_OL_ItemRecipientAdd1: @error = 0, @extended = 0
_OL_ItemRecipientAdd2: @error = 0, @extended = 0
_OL_ItemSend:          @error = 2, @extended = -2147352567
_OL_Close:             @error = 0, @extended = 1

This is what I get...

Posted

Could you please try with just one recipient and then the other? So we know which name can't be resolved.
Just remove the first _OL_ItemRecipientAdd, run the script and then remove the other and rerun.

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

 

Posted

The address is resolving in Outlook but shows here that it is not. Not sure what might have gone wrong and if there is a provision in OutlookEX to automatically resolve the name.

Posted

Could you please run function _OL_ITemRecipientCheck for $sDefaultMail?

#include <OutlookEX.au3>
#include <Array.au>
Global $sDefaultMail = "...." ; <=== Recipient goes here
Global $oOL = _OL_Open()
Global $aResult = _OL_ItemRecipientCheck($oOL, $sDefaultMail)
_ArrayDisplay($aResult)

Could you please post the (anonymized) results?

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

 

Posted

vvvv.xxx.yyyy.zzzz.@aaaa.com|True|||vvvv.xxx.yyyy.zzzz.@aaaa.com|0|vvvv xxxx yyyy zzzz

Col 0                                               Col1       Col4                                                     Col6



Hope this makes sense.. 

Posted

Is it a typo or is there a dot before the @?

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

 

Posted
Just now, water said:

Is it a typo or is there a dot before the @?

Sorry, that's a typo. The address has 3 periods. When checked with $sMail, I got the similar results i.e. True.

Posted

Very, very strange :huh:
A workaround could be to run _OL_ItemRecipientCheck for this address and then pass $aResult[1][2] to _OL_ItemRecipientAdd in place of $sDefaultMail.

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

 

Posted

And I thought we almost had it...

_OL_ItemCreate:        @error = 0, @extended = 0
_OL_ItemAttachmentAdd: @error = 0, @extended = 0
_OL_ItemRecipientAdd1: @error = 0, @extended = 0
_OL_ItemSend:          @error = 2, @extended = -2147352567
_OL_Close:             @error = 0, @extended = 1

Passed the array to _OL_ItemRecipientAdd and tried sending the email. Still the same result...

This is what the command looks like :

Global $aResult = _OL_ItemRecipientCheck($oOL, $sDefaultMail)
_OL_ItemRecipientAdd($oOL, $oItem, Default, 1, $aResult[1][2])

 

Posted

Is there a way for us to be able to send it without resolving it? I have no idea why it might be doing so when both the emails are resolved properly..

Posted

Try it without _OL_ItemRecipientAdd.

#include "..\OutlookEX.au3"
Global $oOL = _OL_Open()
Global $sDefaultMail = "Recipient 1", $sMail = "Recipient 2", $sLogFile = @ScriptDir & "\Test.log" ; <=== MODIFY
$oItem = _OL_ItemCreate($oOL, $olMailItem, "", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML, "Body=Test")
_OL_ItemAttachmentAdd($oOL, $oItem, Default, $sLogFile)
$oTemp = $oItem.Recipients.Add($sDefaultMail)
$oTemp.Type = 1
$oTemp.Resolve
_OL_ItemSend($oOL, $oItem, Default)
_OL_Close($oOL)

 

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

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...