Jump to content
water

OutlookEX UDF - Help & Support (IV)

Recommended Posts

water

As the OutlookEX UDF - Help & Support thread has grown too big, I'm starting a new one.
The original thread can be found here.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Skysnake

:)

thank you for the prompt response.

  • You can set the profile to be used when calling function _OL_Open, parameter $sProfileName.

What must this $Profilename look like?

I tried to put in my name like this "*my name" - where corresponds with the "account name" in my Outlook.

Global $oOutlook = _OL_Open(False, "", 1000, 1000, "*my name")

Used the * to guarantee a unique name

Got this error...

Error 10, 0

Extended 1003 , 1

:)


Okay, this is not going to work.  Google shows this

Outlook profile
A profile is what Outlook uses to remember the email accounts established within it and the settings that tell Outlook where your email and other data is stored. A new profile is created automatically when you run Outlook for the first time.

That means that the Profile name and any possible email accounts are not the same thing and there can by multiple email accounts inside a given profile.

This changes the nature of the question.  How to select a specific email address from a profile?

Unsurprisingly my Outlook profile is named "Outlook" - it contains seven email addresses...

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites
Skysnake

Any reason why Windows Live Mail would truncate PDF attachments?  Tested with Gmail, Thunderbird and Outlook & Outlook for Exchange.  All these work and receive attachments.  Live appears to hide/truncate the attachment... ?


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites
water

Is this problem related to the OutllookEX UDF or do you see it as well when you manually open such a mail?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Skysnake

Both :)

I sent a PDF  using the UDF to multiple recipients.  All confirmed receipt.  One destination reported that "the email had no attachment" - I sent that directly from Outlook (ie not using the UDF) and also did not receive the PDF attachment.

 


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites
water

Which mail format do you use? Text, HTML or RTF?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Skysnake

HTML Body, but it contains only one line referring to the PDF attachment (not a link)


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites
alexandre17

Hi all,

How to select a signature via your lib ?

My function, but I don't find how to choose signature?

Func Creer_mail($email_destinataire,$sujet,$pj1,$pj2)
   Global $oItem
   Global $oOutlook = _OL_Open()
   If @error <> 0 Then Exit MsgBox(16, "Acacia Dynamic", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)

   $oItem = _OL_ItemCreate($oOutlook, $olMailItem, "", "", "Subject=" & $sujet, "BodyFormat=" & $olFormatHTML)
   If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error creating a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = " & @error & ", @extended = " & @extended)
   ; Add a recipient and resolve it
   _OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olTo, $email_destinataire)

   ; Add all attachments
   ;$oItem = _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, @ScriptDir & "\The_Outlook.jpg")
   If $pj1<>"" Then
      $oItem = _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, $pj1)
      If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error adding an attachment to a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = "  & @error & ", @extended = " & @extended)
   EndIf

   If $pj2<>"" Then
      $oItem = _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, $pj2)
      If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error adding an attachment to a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = "  & @error & ", @extended = " & @extended)
   EndIf


  $oItem.GetInspector
  $sSignature = $oItem.HTMLBody
  $sBody = "Plop<br>Plip"
  $oItem.HTMLBody = $sBody & $sSignature

   $oItem.Display
   MsgBox(64, "OutlookEX UDF: _OL_ItemCreate Example Script", "Mail with inline picture created.")

   MsgBox(64, "OutlookEX UDF: _OL_ItemCreate Example Script", "All items successfully created in 'Outlook-UDF-Test\TargetFolder' and its subfolders!")

   _OL_Close($oOutlook)
EndFunc

 

Share this post


Link to post
Share on other sites
water

Use function _OL_MailSignatureSet before creating the mail item to set the needed signature.
If needed you could grab the current default signatures using _OL_MailSignatureGet, then set the new signature with _OL_MailSignatureSet, create the mail item and then reset the default signature with the values from _OL_MailSignatureGet.

I will check if there is an easier way to add a specific signature.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
alexandre17

when I try :

Global $aSignatures = _OL_MailSignatureGet()
   If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_MailSignatureGet Example Script", "Error accessing mail signatures. @error = " & @error & ", @extended: " & @extended)
   _ArrayDisplay($aSignatures, "OutlookEX UDF: All email signatures for the current mail account", "", 0, "|", "Name|Used for new messages?|Used for reply messages?")

I have got an error "Error accessing mail signatures. @error = 1, @extended: -2147221005

Idem for _OL_MailSignatureSet

Signature 'Outlook-UDF-Test' could not be set. @error = 1, @extended: -2147221005

Can You help me?

Share this post


Link to post
Share on other sites
water

Is Microsoft Word installed on the computer where you run the script?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
alexandre17

No I have only outlook 2010

Share this post


Link to post
Share on other sites
water

That causes the error message you see.
Outlook uses MS Word as the editor for Signatures.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
alexandre17

ok,

I have made a loop create 50 mails with the same function.

Some time I have Error creating mail in folder @error=4,  @extended: -2147221005

And when this error occur I must reboot my pc, and all become ok.

Why ?

My function

Func Creer_mail($oOutlook,$email_destinataire,$sujet,$pj1,$pj2,$chem_modele_html)
   Global $oItem

   $oItem = _OL_ItemCreate($oOutlook, $olMailItem, "", "", "Subject=" & $sujet, "BodyFormat=" & $olFormatHTML)
   If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error creating a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = " & @error & ", @extended = " & @extended)


   ; Add a recipient and resolve it
   If $email_destinataire<>"" Then
   _OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olTo, $email_destinataire)
   EndIf

   ; Add all attachments
   If $pj1<>"" Then
      $oItem = _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, $pj1)
      If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", $pj1 & "Error adding an attachment to a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = "  & @error & ", @extended = " & @extended)
   EndIf

   If $pj2<>"" Then
      $oItem = _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, $pj2)
      If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", $pj2 & "Error adding an attachment to a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = "  & @error & ", @extended = " & @extended)
   EndIf


  $oItem.GetInspector

  $sBody =  $chem_modele_html
  $oItem.HTMLBody = $sBody

EndFunc

An his call

$oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "AAA", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)

$sBody="AA<br>bb"

For $i=0 To 99
    Creer_mail($oOutlook,$i & "a@a.com","Invoide s","C:\Users\vmware\Desktop\exporteur\3 Facturation\2017\201712\201712 - Facturation ddd - Synthese.pdf","C:\Users\vmware\Desktop\exporteur\3 Facturation\2017\201712\201712 - Facturation ddd.pdf",$sBody)
Next
_OL_Close($oOutlook)

 

Share this post


Link to post
Share on other sites
water

That's the same error as in post #17. Do you by any chance call the signature function which needs MS Word?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

The following lines

$oItem.Getspector

  $sBody =  $chem_modele_html
  $oItem.HTMLBody = $sBody

can be written as

;  $oItem.GetinInspector
  $oItem.HTMLBody = $chem_modele_html

I'm not sure GetInspector is needed any longer.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
alexandre17

No I haven't call signature.

without $oItem.GetInspector the body it's empty

Share this post


Link to post
Share on other sites
water

Version 1.3.2.0 of the UDF has been released.

Please test before using in production!

For download please see my signature.

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

My bad :>
You know there is a typo in your code and your last post? It should be:  $oItem.GetInspector

What happens when you add a Sleep(500) into the loop before sending each mail?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • Reizvoller
      By Reizvoller
      Howdy!
      I've been reading through the OutLookEX documentation and examples for the past two days ( VERY well documented, very clear! ) 
      https://www.autoitscript.com/wiki/OutlookEX_UDF_-_General
       
      But I've had trouble locating information on specifying what user to use. My outlook is linked to two email accounts and I can only manipulate the main account's stuff. A simple script I've been playing with is this 
      ; Include Functions #include <OutlookEX.au3> ; Connect to Outlook Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "Connect to Outlook", "Error connecting to Outlook. @error = " & @error & ", @extended = " & @extended) ;List the folders Global $aResult = _OL_FolderTree($oOutlook, "*") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderTree Example Script", "Error accessing root folder. @error = " & @error) _ArrayDisplay($aResult, "OutlookEX UDF: _OL_FolderTree Example Script - All folders") It works like a charm but it only returns my main account's folders. 
      I really hope I didn't overlook a wiki page or help file... 
      Any assistance would be greatly appreciated!
      -Reiz
    • galan2015
      By galan2015
      Is there any solution on receiving e-mails? I would like to create a script so that I will not have to log in through the browser.
×