Lights_On Posted February 3, 2017 Posted February 3, 2017 Hi All, I have the below code: ShellExecute("mailto:" & $TheEmailAddress & "?subject=" & $Subject & "&importance=high" & "&body=" & $Message & "&attachment=" & $Attachment, "", @TempDir) This works fine other than I wish to be able to: Add an attachment (the ‘&attachment=’ does not work) Set the priority (the ‘&priority=’ does not work) Have the body of the text not remove the default signature. Ideally have the body of the text as a separate template or similar. I am aware I can use solutions that send the email quietly in the background and I do indeed use these. But for this purpose I need for the email to be opened so I can make amendments before sending the email if required. Thank you in advance for any suggestions.
water Posted February 3, 2017 Posted February 3, 2017 Which mail client 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
Lights_On Posted February 3, 2017 Author Posted February 3, 2017 Hi Water, Thank you for your time. I use Outlook 2010.
water Posted February 3, 2017 Posted February 3, 2017 Then you could use my OutlookEX UDF to do all the things you want (and more) in the background. 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
Lights_On Posted February 3, 2017 Author Posted February 3, 2017 Thank you - I saw this and it is excellent - however does this not only do things "in the background"? I seek to have the email in the foreground so the I can make amendments if desired.
water Posted February 3, 2017 Posted February 3, 2017 (edited) The UDF supports processing in the back- and foreground - as you like. For example: #include <OutlookEX.au3> Global $oItem Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) ; Create the item $oItem = _OL_ItemCreate($oOutlook, $olMailItem, "*", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating the mail item. @error = " & @error & ", @extended = " & @extended) ; Add an attachments $oItem = _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, @ScriptDir & "\The_Outlook.jpg") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error adding an attachment to the mail item. @error = " & @error & ", @extended = " & @extended) ; Display the mail item $oItem.Display Edited February 3, 2017 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
Lights_On Posted February 3, 2017 Author Posted February 3, 2017 (edited) Wonderful - thank you. I shall try that out. it appears i had overlooked the part that shows the item: ; Display the mail item $oItem.Display Edited February 3, 2017 by Lights_On
Lights_On Posted February 7, 2017 Author Posted February 7, 2017 Hi Water, Thank you again - this is working great. A quick question that may seem obvious but just wanted to seek clarity. Should I always 'OL_Open)' but only 'OL_close()' if i want to close Outlook? So should I check if Outlook is open first and then make a choice as to how I use 'OL_close()'? I seek to never close Outlook but I will need to open it if its not running as I don't want the action to happen in the background. I read the below but still had a few '???' around my question: " Remarks: If Outlook was already running when _OL_Open was called you have to use flag $bForceClose to close Outlook. If Outlook was already running when _OL_Open was called @extended is set to 1 to indicate this " I hope my question is clear? Thank you in advance.
water Posted February 7, 2017 Posted February 7, 2017 1) Outlook has been started by the user before When you run _OL_Open the UDF attaches to the already running instance and sets @extended = 1 to let you know that Outlloks was started by the user. When you run _OL_Close parameter $bForceClose set to False then the script detaches from Outlook but Outlooks remains up and running. When you run _OL_Close parameter $bForceClose set to True then the script detaches from Outlook and forcefully shuts down Outlook as well. 2) Outlook has not been started by the user before _OL_Open starts Outlook and attaches the script to this newly started instance. _OL_Close independant of parameter $bForceClose detaches the script from Outlook and shuts Outlook down. Conclusion: Most of the time a simple _OL_Open at the start of your script and _OL_Close at the end is sufficient. 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
Lights_On Posted February 7, 2017 Author Posted February 7, 2017 Perfect - completely understood. Thank you.
water Posted February 7, 2017 Posted February 7, 2017 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
Partyflight Posted October 29, 2020 Posted October 29, 2020 Can somebody help me? I m trying to get an attachement to the script but it gives me always an error. What do I wrong. This is the script: #include <OutlookEX.au3> Global $oOutlook = _OL_Open() Global $bodyvar = "put body text here" Global $recipientAddress = "EMAIL" Global $subjectvar = "subject" Global $AttachFiles = "C:\Capture.jpeg" _OL_Wrapper_SendMail($oOutlook, $recipientAddress, "", "", $subjectvar, $AttachFiles, $bodyvar) 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 '" & $recipientAddress & "'!")
water Posted October 29, 2020 Posted October 29, 2020 3 minutes ago, Partyflight said: but it gives me always an error. Please provide more detailed information. 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
Partyflight Posted October 29, 2020 Posted October 29, 2020 I m trying to autosend a specific file from my computer to a recipient every day on the same hoor without opening Outlook.
seadoggie01 Posted October 29, 2020 Posted October 29, 2020 Water means, what text do you see in the message box that pops up? "An error" could mean anything from you don't have Outlook installed to you're running an old version of AutoIt to the file not existing. We need specifics to help All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
water Posted October 29, 2020 Posted October 29, 2020 This means: Output of the SciTE console and @error plus @extended after you call _OL_Wrapper_SendMail. 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
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 accountSign in
Already have an account? Sign in here.
Sign In Now