nitekram Posted April 3, 2015 Posted April 3, 2015 That works - thanks so much...and it was tested, by me lol. Sorry, I should have made mention to that little tidbit. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
water Posted April 3, 2015 Author Posted April 3, 2015 Great that your problem could be solved 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
nitekram Posted April 9, 2015 Posted April 9, 2015 Question about sending emails. Is there anyway to open the email being sent - for updates, whatever is needed to add before sending it? I have to add a screenshot, that will not be easy to automate. I already have an attached screenshot in the email, but I need to add another one manually. Is there an option to open the email, with all the information (meaning ready to send, just press the send button) and then do what I need to do, and then manually press the send button? I am thinking maybe an optional parameter for _OutlookSendMail() - like see email before sending (True, False)? 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
water Posted April 9, 2015 Author Posted April 9, 2015 _OutlookSendMail is a function from the "old" Outlook UDF. Which version of the UDF do you run? 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
nitekram Posted April 9, 2015 Posted April 9, 2015 (edited) I could not find any version info in the UDF, so I either can post it or send it to you? EDIT Can post the functions, maybe that will help? ; #CURRENT# ===================================================================================================================== ;_OutlookOpen ;_OutlookSendMail ;_OutlookGetMail ;_OutlookSaveMail ;_OutlookDeleteMail ;_OutlookCopyMail - Not started ;_OutlookMoveMail - Not started ;_OutlookCreateNote ;_OutlookGetNotes ;_OutlookDeleteNote ;_OutlookModifyNote ;_OutlookCreateTask ;_OutlookGetTasks ;_OutlookDeleteTask ;_OutlookModifyTask ;_OutlookCreateAppointment ;_OutlookGetAppointments ;_OutlookModifyAppointment - Modify single appointment in a recurring appointment doesn't work. ;_OutlookDeleteAppointment - Not started ;_OutlookCreateContact ;_OutlookGetContacts ;_OutlookModifyContact - Not started ;_OutlookDeleteContact - Not started ;_OutlookCreateDistList ;_OutlookGetDistLists ;_OutlookDeleteDistList ;_OutlookDeleteDistListMember ;_OutlookModifyDistList - Not working ;_OutlookFolderExist ;_OutlookFolderAdd ;_OutlookFolderDelete ;_OutlookError . Edited April 9, 2015 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
nitekram Posted April 9, 2015 Posted April 9, 2015 (edited) Where is the newest version, I can just download that and update my code with the new version. Does the new version allow for being able to view the email, or even put it in a draft would work as well. EDIT >found it EDIT I found the version, as it is the link above - 1.0.0.0 EDIT I lied, I downloaded it but never used it, let me check this new version, and maybe my question will be answered Edited April 9, 2015 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
water Posted April 10, 2015 Author Posted April 10, 2015 The new OutlookEX UDF (EX stands for extended) is a complete rewrite. All functions are named _OL_*. 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
nitekram Posted April 10, 2015 Posted April 10, 2015 (edited) Okay, I uploaded my code to the newest version 1.0.0.0 So now my code has the following function call _OL_Wrapper_SendMail($oOutlook, $sTo, "", "", $sSubject, $sBody & @CRLF, $sAttachments, $olFormatRichText) But the same code, with the other UDF, would show the body text above the attached file, making it look nicer. And is there a way to fix that, or is that by design. I still would like to know if there is some function in the extended UDF, that would allow me to actually stop the email (bring a window up with all the automated text and attachment), and adjust something before actually sending the email? Edit Added the by design comment Edited April 10, 2015 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
water Posted April 10, 2015 Author Posted April 10, 2015 _OL_Wrapper_SendMail is a wrapper to a function of the old UDF to create and send a mail in one go. Not possible to display the mail before sending. Use the functions _OL_Wrapper_SendMail consists of to create your mail and display it. $oItem = _OL_ItemCreate(...) $oItem.Display() See example 4 in_OL_ItemCreate.au3. 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
nitekram Posted April 10, 2015 Posted April 10, 2015 (edited) I am looking into that, but getting error while just trying to run the example - msgbox with Manage Test Enviroment Error=510 Extended=1000 and when I run just the example 4 in my code, I get the following, same message box, but error 509 extended = 4 How do I resolve to test? Why is it creating a testenvironment with each new call (script run)? Never mind, I see I can just comment that out. EDIT Okay, after commenting out that function call (Global $Result = _OL_TestEnvironmentCreate($oOutlook)) I get the following: error creating a mail in folder 'Outlook-UDF-TestTargetFoldermail' error=1 extended=4 Edited April 10, 2015 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
nitekram Posted April 10, 2015 Posted April 10, 2015 (edited) I have tried to run the test: _OL_FolderAccess() I get error = 4, I added the macro (@extended) and extended = 3 I have created a folder structure in the root of where the exe (script) is running Outlook-UDF-TestTargetFolderMail, but that did nothing. I thought maybe it did not have access to it, as it did not exist - but I am new to this UDF, so not sure. No array shows, so unable to view any other info. EDIT cleaned it up Edited April 10, 2015 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
water Posted April 10, 2015 Author Posted April 10, 2015 The example scripts rely on the Test-Environment. If this environment is successfully created then the example scripts should run fine. Which version of Outlook do you run? Which Windows version do you run? Which version of AutoIt? 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
water Posted April 10, 2015 Author Posted April 10, 2015 (edited) This should create the required mail and display it. The user has to press "Send" or cancel the mail. expandcollapse popup#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y #include <OutlookEX.au3> Global $sSubject = "Test" Global $iBodyFormat = $olFormatRichText Global $sBody = "TestBody" Global $sTo = "" Global $sAttachments = "" Global $oOL = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) ; Access the default outbox folder Global $aFolder = _OL_FolderAccess($oOL, "", $olFolderDrafts) If @error Then Exit MsgBox(16, "OutlookEX UDF", "FolderAccess: @error = " & @error & ", @extended = " & @extended) ; Create a mail item in the default folder Global $oItem = _OL_ItemCreate($oOL, $olMailItem, $aFolder[1], "", "Subject=" & $sSubject, "BodyFormat=" & $iBodyFormat) If @error Then Exit MsgBox(16, "OutlookEX UDF", "ItemCreate: @error = " & @error & ", @extended = " & @extended) ; Set the body according to $iBodyFormat If $iBodyFormat = $olFormatHTML Then _OL_ItemModify($oOL, $oItem, Default, "HTMLBody=" & $sBody) Else _OL_ItemModify($oOL, $oItem, Default, "Body=" & $sBody) EndIf If @error Then Exit MsgBox(16, "OutlookEX UDF", "ItemModify: @error = " & @error & ", @extended = " & @extended) ; Add recipient Global $aRecipients $aRecipients = StringSplit($sTo, ";", 2) _OL_ItemRecipientAdd($oOL, $oItem, Default, $olTo, $aRecipients) If @error Then Exit MsgBox(16, "OutlookEX UDF", "RecipientAdd: @error = " & @error & ", @extended = " & @extended) ; Add attachments If $sAttachments <> "" Then Global $aAttachments = StringSplit($sAttachments, ";", 2) _OL_ItemAttachmentAdd($oOL, $oItem, Default, $aAttachments) If @error Then Exit MsgBox(16, "OutlookEX UDF", "AttachmentAdd: @error = " & @error & ", @extended = " & @extended) EndIf ; Display item $oItem.Display ; Send mail ; _OL_ItemSend($oOL, $oItem, Default) ; If @error Then Return SetError(@error + 6000, @extended, 0) _OL_Close($oOL) Edited April 10, 2015 by water nitekram 1 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
nitekram Posted April 10, 2015 Posted April 10, 2015 (edited) I will put that back in and see if it creates it. Which version of Outlook do you run? Next time I am at work I will check, but believe 2013 Which Windows version do you run? Win7 64bit Which version of AutoIt? I will be get version later today Edited April 10, 2015 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
nitekram Posted April 10, 2015 Posted April 10, 2015 This should create the required mail and display it. The user has to press "Send" or cancel the mail.expandcollapse popup#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y #include <OutlookEX.au3> Global $sSubject = "Test" Global $iBodyFormat = $olFormatRichText Global $sBody = "TestBody" Global $sTo = "" Global $sAttachments = "" Global $oOL = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) ; Access the default outbox folder Global $aFolder = _OL_FolderAccess($oOL, "", $olFolderDrafts) If @error Then Exit MsgBox(16, "OutlookEX UDF", "FolderAccess: @error = " & @error & ", @extended = " & @extended) ; Create a mail item in the default folder Global $oItem = _OL_ItemCreate($oOL, $olMailItem, $aFolder[1], "", "Subject=" & $sSubject, "BodyFormat=" & $iBodyFormat) If @error Then Exit MsgBox(16, "OutlookEX UDF", "ItemCreate: @error = " & @error & ", @extended = " & @extended) ; Set the body according to $iBodyFormat If $iBodyFormat = $olFormatHTML Then _OL_ItemModify($oOL, $oItem, Default, "HTMLBody=" & $sBody) Else _OL_ItemModify($oOL, $oItem, Default, "Body=" & $sBody) EndIf If @error Then Exit MsgBox(16, "OutlookEX UDF", "ItemModify: @error = " & @error & ", @extended = " & @extended) ; Add recipient Global $aRecipients $aRecipients = StringSplit($sTo, ";", 2) _OL_ItemRecipientAdd($oOL, $oItem, Default, $olTo, $aRecipients) If @error Then Exit MsgBox(16, "OutlookEX UDF", "RecipientAdd: @error = " & @error & ", @extended = " & @extended) ; Add attachments If $sAttachments <> "" Then Global $aAttachments = StringSplit($sAttachments, ";", 2) _OL_ItemAttachmentAdd($oOL, $oItem, Default, $aAttachments) If @error Then Exit MsgBox(16, "OutlookEX UDF", "AttachmentAdd: @error = " & @error & ", @extended = " & @extended) EndIf ; Display item $oItem.Display ; Send mail ; _OL_ItemSend($oOL, $oItem, Default) ; If @error Then Return SetError(@error + 6000, @extended, 0) _OL_Close($oOL) I will test this when I get to work, but a follow up question. After looking at your code, it appears I might be able to use html in my email. If I wanted to insert a pic, would I just use html tags to pull the pic from a file, and the I can use html to create the body of the email? Still new to this udf, but I really thank you for all your work on all these office apps. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
water Posted April 10, 2015 Author Posted April 10, 2015 Example 4 in _OL_ItemCreate.au3 shows how to attach a picture to an email and insert it into html code. 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
nitekram Posted April 10, 2015 Posted April 10, 2015 (edited) The code you posted works, but I am trying to change that to be able to embed the image. I have a folder within my script directory called 'UIP' - it contains the images that I would need to embed, but all I am getting is a RED X and the file attached to the email. ; Add attachments If $sAttachments <> "" Then $oItem = _OL_ItemAttachmentAdd($oOL, $oItem, Default, @ScriptDir & '\uip' & $sAttachments) ;, @ScriptDir & "\_OL_ItemCopy.au3, 4", @ScriptDir & "\_OL_Foldertree.au3") If @error Then Exit MsgBox(16, "OutlookEX UDF", "AttachementAdd: @error = " & @error & ", @extended = " & @extended) $sAttachments = StringMid($sAttachments, 2) ;MsgBox('','$sAttachments',$sAttachments) ;Return ; Modify the item to add HTML that refers to the picture $oItem = _OL_ItemModify($oOL, $oItem, Default, "HTMLBody=<img src='cid:" & $sAttachments & "'>") ;HTMLBody=Bodytext in <b>bold</b><img src='cid:qtip.jpg'>Embedded image. If @error Then Exit MsgBox(16, "OutlookEX UDF", "ItemModify: @error = " & @error & ", @extended = " & @extended) EndIf Can you tell me what I am missing, as I am able to figure it out, if the file is in the same directory as the script, but not if it is in another folder, one level down from where the script is EDIT Also when this happens my subject text is no longer visible. Edited April 10, 2015 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
water Posted April 11, 2015 Author Posted April 11, 2015 What is the value of $sAttachments when used with "cid:"? It should only be filename.ext 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
nitekram Posted April 11, 2015 Posted April 11, 2015 Okay, I thought it might be something as I was driving home last night, and sure enough I found the answer. If you have spaces in your file name it will not work. Once I removed them, it came up as expected. I did not read that, but I might have missed it - if it is not in the notes, we know now what causes it. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
water Posted April 11, 2015 Author Posted April 11, 2015 Thanks for the reply. I will test if this is a problem with the attachment add function or the HTML code. 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
Recommended Posts