Jump to content

OutlookEX UDF - Help & Support (III)


water
 Share

Recommended Posts

Holy Mother of God!!! 
That worked for both $sDefaultMail and $sMail.

_OL_ItemCreate:        @error = 0, @extended = 0
_OL_ItemAttachmentAdd:        @error = 0, @extended = 0
$oItem.Recipients1):        @error = 0, @extended = 0
$oTemp.Type1:        @error = 0, @extended = 0
$oItem.Recipients2:        @error = 0, @extended = 0
$oTemp.Type2:        @error = 0, @extended = 0
$oTemp.Resolve:        @error = 0, @extended = 0
_OL_ItemSend:        @error = 0, @extended = 0
_OL_Close:        @error = 0, @extended = 1

For second address, I chose type 2 as I needed it to be CC.  Received emails on both mailboxes and being a noob, I have no idea what any of that is doing.

This completes my project and last bug to squish!!! 
Thank you so much water! :D:D:D:D 
 

Link to comment
Share on other sites

Glad we got it working :D
I think I will need to brush up function _OL_ItemRecipientAdd!

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

This is the modified version of the function (untested as I modified the code on my Linux home computer) - combined with our test script:

#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_ItemRecipientAddEX($oOL, $oItem, Default, 1, $sDefaultMail)
ConsoleWrite("_OL_ItemRecipientAdd1: @error = " & @error & ", @extended = " & @extended & @CRLF)
_OL_ItemRecipientAddEX($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)
Exit

; #FUNCTION# ====================================================================================================================
; Name ..........: _OL_ItemRecipientAdd
; Description ...: Adds one or multiple recipients to an item and resolves them.
; Syntax.........: _OL_ItemRecipientAdd($oOL, $vItem, $sStoreID, $iType, $vP1 = ""[, $vP2 = ""[, $vP3 = ""[, $vP4 = ""[, $vP5 = ""[, $vP6 = ""[, $vP7 = ""[, $vP8 = ""[, $vP9 = ""[, $vP10 = ""[, $bAllowUnresolved = True]]]]]]]]]])
; Parameters ....: $oOL              - Outlook object returned by a preceding call to _OL_Open()
;                  $vItem            - EntryID or object of the item item
;                  $sStoreID         - StoreID where the EntryID is stored. Use the keyword "Default" to use the users mailbox
;                  $iType            - Integer representing the type of recipient. For details see Remarks
;                  $vP1              - Recipient to add to the item. Either a recipient object or the recipients name to be resolved
;                  +or a zero based one-dimensional array with unlimited number of recipients (name or object)
;                  $vP2              - Optional: recipient to add to the item. Either a recipient object or the recipients name to be resolved
;                  $vP3              - Optional: Same as $vP2
;                  $vP4              - Optional: Same as $vP2
;                  $vP5              - Optional: Same as $vP2
;                  $vP6              - Optional: Same as $vP2
;                  $vP7              - Optional: Same as $vP2
;                  $vP8              - Optional: Same as $vP2
;                  $vP9              - Optional: Same as $vP2
;                  $vP10             - Optional: Same as $vP2
;                  $bAllowUnresolved - Optional: True doesn't return an error even when unresolvable SMTP addresses have been found (default = True)
; Return values .: Success - Item object
;                  Failure - Returns 0 and sets @error:
;                  |1 - No item specified
;                  |2 - Item could not be found. EntryID might be wrong
;                  |5 - $iType is missing or not a number
;                  |3nn - Error adding recipient to the item. @extended = error code returned by the Recipients.Add method, nn = number of the invalid recipient (zero based)
;                  |4nn - Recipient name could not be resolved. @extended = error code returned by the Resolve method, nn = number of the invalid recipient (zero based)
; Author ........: water
; Modified.......:
; Remarks .......: $vP2 to $vP10 will be ignored if $vP1 is an array of recipients
;                  +
;                  Valid $iType parameters:
;                  MailItem recipient: one of the following OlMailRecipientType constants: olBCC, olCC, olOriginator, or olTo
;                  MeetingItem recipient: one of the following OlMeetingRecipientType constants: olOptional, olOrganizer, olRequired, or olResource
;                  TaskItem recipient: one of the following OlTaskRecipientType constants: olFinalStatus, or olUpdate
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _OL_ItemRecipientAddEX($oOL, $vItem, $sStoreID, $iType, $vP1, $vP2 = "", $vP3 = "", $vP4 = "", $vP5 = "", $vP6 = "", $vP7 = "", $vP8 = "", $vP9 = "", $vP10 = "", $bAllowUnresolved = True)

    Local $oRecipient, $aRecipients[10], $oTempRecipient
    If Not IsNumber($iType) Then Return SetError(5, 0, 0)
    If Not IsObj($vItem) Then
        If StringStripWS($vItem, 3) = "" Then Return SetError(1, 0, 0)
        $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID)
        If @error Then Return SetError(2, @error, 0)
    EndIf
    ; Move members into an array
    If Not IsArray($vP1) Then
        $aRecipients[0] = $vP1
        $aRecipients[1] = $vP2
        $aRecipients[2] = $vP3
        $aRecipients[3] = $vP4
        $aRecipients[4] = $vP5
        $aRecipients[5] = $vP6
        $aRecipients[6] = $vP7
        $aRecipients[7] = $vP8
        $aRecipients[8] = $vP9
        $aRecipients[9] = $vP10
    Else
        $aRecipients = $vP1
    EndIf
    ; add recipients to the item
    #forceref $oTempRecipient ; to prevent the AU3Check warning: $oTempRecipient: declared, but not used in func.
    For $iIndex = 0 To UBound($aRecipients) - 1
        If Not IsObj($aRecipients[$iIndex]) And StringStripWS($aRecipients[$iIndex], 3) = "" Then ContinueLoop
        $oTempRecipient = $vItem.Recipients.Add($aRecipients[$iIndex])
        If @error Then Return SetError(300 + $iIndex, @error, 0)
        $oTempRecipient.Type = $iType
        $oTempRecipient.Resolve
        If @error Or Not $oTempRecipient.Resolved Then
            If Not (StringInStr($aRecipients[$iIndex], "@")) Or Not ($bAllowUnresolved) Then
                $oTempRecipient.Delete ; Remove unresolved/recipient in error
                Return SetError(400 + $iIndex, @error, 0)
            EndIf
        EndIf
    Next
    $vItem.Save()
    Return $vItem

EndFunc   ;==>_OL_ItemRecipientAddEX

 

Edited by water
Fixed a bug

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Thank you. I will give it a try and post results shortly.
One more thing I wanted to ask about is the warning program when defining

_OL_Open(True)

It says that we have to design our own warning program . I am trying to understand what kind of program am I looking at? I have seen some warnings pop up when testing my script on different computers and it is really sporadic. The warnings does not always happen.

Link to comment
Share on other sites

The UDF comes with an example program: _OL_Warnings.au3
Compile it and it should work in most environments. Documentation can be found in the example script.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

The old version created the recipient with the session object and tried to resolve it. When successful it was added to the mails object.
The new version creates the recipient with the mail object and tries to resolve it. When unsuccessful the recipient is removed again.

I don't know why the old version did'nt work in some rare cases, but the new seems to be more reliable :)

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

_OL_Open uses run to start _OL_Warnings.exe (default name).
So if you pack it with your script you need to use FileInstall to extract _OL_Warnings.exe to a callable file.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

#include <OutlookEx.au3>
$sDefaultMail= 'abc@gmail.com'
$oOutlook = _OL_Open()
$oMail = _OL_ItemCreate($oOutlook, $olMailItem, "", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML, _
    'HTMLBody=This is a picture.<img src="cid:The_Outlook.jpg">This is more text.')
_OL_ItemAttachmentAdd($oOutlook, $oMail, Default, @ScriptDir & "\The_Outlook.JPG")
_OL_ItemRecipientAdd($oOutlook, $oMail, Default, 1, $sDefaultMail)
_OL_ItemSend($oOutlook, $oMail, Default)
_OL_Close($oOutlook)

Dear water,
1. This code work fine in outlook 2016 app, but when i check in gmail web, it's not ok? (Picture attach)
2. How can i change "Content-Transfer-Encoding: 7bit" to  "Content-Transfer-Encoding: base64"
"Content-Type: application/ms-tnef; name="winmail.dat" to "Content-Type: image/jpeg; name="The_Outlook.jpg"?
Help me!!

Gmail.png

Outlook.png

Link to comment
Share on other sites

Does example 4 in _OL_Itemcreate.au3 work for you?
IIRC it needs to be the other way round: First attach the picture then set the mail body and reference the picture.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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 check the Download page for ver 1.3.1.0

File Link give errors message for both links "

The page you are trying to access is not available for your account.

Error code: 2C171/1

"

I'm logged into the Forum as usual , I am able to get other downloads , so guessing their are issues with the Links, there are 2 listed there one

for Outlookex.zip and another for Outlookex 1.3.0.0.zip

 

Any eta for adding the _OL_NavigationFolderSet

 

 

 

Edited by HighlanderSword
Link to comment
Share on other sites

Will check tomorrow.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

15 hours ago, water said:

Does example 4 in _OL_Itemcreate.au3 work for you?
IIRC it needs to be the other way round: First attach the picture then set the mail body and reference the picture.

I try to use example 4:
 

#include <OutlookEX.au3>
Global $oOutlook = _OL_Open()
Global $oItem
$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML)
$oItem = _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, @ScriptDir & "\The_Outlook.jpg", @ScriptDir & "\_OL_ItemCopy.au3", @ScriptDir & "\_OL_Foldertree.au3")
$oItem = _OL_ItemModify($oOutlook, $oItem, Default, "HTMLBody=Bodytext in <b>bold</b><img src='cid:The_Outlook.jpg'>Embedded image.")
_OL_ItemRecipientAdd($oOutlook, $oItem, Default, 1, 'abc@gmail.com')
_OL_ItemSend($oOutlook, $oItem, Default)
_OL_Close($oOutlook)

1.It still display ok in outlook but doesn't work in mail google web
2. I try to edit

$oItem = _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, @ScriptDir & "\The_Outlook.jpg", @ScriptDir & "\_OL_ItemCopy.au3, 4", @ScriptDir & "\_OL_Foldertree.au3")

to

$oItem = _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, @ScriptDir & "\The_Outlook.jpg,1,1,The_Outlook.jpg", @ScriptDir & "\_OL_ItemCopy.au3, 1,1,_OL_ItemCopy.au3", @ScriptDir & "\_OL_Foldertree.au3,1,1,_OL_Foldertree.au3")


it show right file attach but inline picture still not work.
i see source mail (Original Message) still  "Content-Type: application/ms-tnef; name="winmail.dat", how can i change it like  "Content-Type: image/jpeg; name="The_Outlook.jpg"?

Test2.png

Test3.png

Edited by tourism123
Link to comment
Share on other sites

@HighlanderSword
Download problem fixed. Seems to be a problem with my Firefox environment.

_OL_NavigationFolderSet will take some time because I'm quite busy at the moment and the design of the function will first need some thinking :)
But you have a workaround. Put it into a separate function until I can release a new version of the UDF.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Different approach:

#include "..\OutlookEX.au3"

Global $oOutlook = _OL_Open()
Global $sPicture = "H:\tools\AutoIt3\OutlookEX\The_Outlook.jpg"

Global $oItem = _OL_ItemCreate($oOutlook, $olMailItem, "", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML)

Global $oAttachment = $oItem.Attachments.Add($sPicture)
Global $sCID = "TestPic1"

Global $PR_ATTACH_CONTENT_ID = "http://schemas.microsoft.com/mapi/proptag/0x3712001E"
$oPropertyAccessor = $oAttachment.PropertyAccessor
$oPropertyAccessor.SetProperty($PR_ATTACH_CONTENT_ID, $sCID)

$oItem = _OL_ItemModify($oOutlook, $oItem, Default, "HTMLBody=Bodytext in <b>bold</b><img src='cid:" & $sCID & "'>Embedded image.")

$oItem.Display()

_OL_Close($oOutlook)

 

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Thanks! Glad the solution works for you :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

@water, do you test it? . i think the way approach is good but it doesn't work for me. 
can you test it with google mail web?
I try edit your code but it still doesn't work. 
:(
 

#include "OutlookEX.au3"

Global $oOutlook = _OL_Open()
Global $sPicture = @ScriptDir & "\SendMailex\Attach File\The_Outlook.jpg"

Global $oItem = _OL_ItemCreate($oOutlook, $olMailItem, "", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML)

Global $oAttachment = $oItem.Attachments.Add($sPicture)
Global $sCID = "myident1"

Global $PR_ATTACH_MIME_TAG = "http://schemas.microsoft.com/mapi/proptag/0x370E001E"
Global $PR_ATTACH_CONTENT_ID = "http://schemas.microsoft.com/mapi/proptag/0x3712001E"
Global $PR_ATTACHMENT_HIDDEN = "http://schemas.microsoft.com/mapi/proptag/0x7FFE000B"

;$oAttachment1 = $oItem.Attachments.item(1)
$oPropertyAccessor = $oAttachment.PropertyAccessor ;$oAttachment1.PropertyAccessor
$oPropertyAccessor.SetProperty($PR_ATTACH_MIME_TAG, "image/jpeg")
$oPropertyAccessor.SetProperty($PR_ATTACH_CONTENT_ID, $sCID)
$oPropertyAccessor.SetProperty($PR_ATTACHMENT_HIDDEN, True)

$oItem.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8514000B", True)

$oItem = _OL_ItemModify($oOutlook, $oItem, Default, "HTMLBody=Bodytext in <b>bold</b><img src='cid:" & $sCID & "'>Embedded image.")
_OL_ItemRecipientAdd($oOutlook, $oItem, Default, 1, 'abc@gmail.com')
;$oItem.Update()
_OL_ItemSend($oOutlook, $oItem, Default)
;$oItem.Display()

_OL_Close($oOutlook)

 

Link to comment
Share on other sites

Sure. I tested my code with Outlook and it worked fine. As I do not have an Gmail account I can't test.
You are sure that Google mail supports inline pictures?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...