YoannMorl Posted November 26, 2012 Share Posted November 26, 2012 (edited) Hi, A little problem for my notification script. When I use this part of script and run it, my generated e-mail does not accept special chars like à ê etc... Do you have any idea on how to do ? Regards. Func _Mail() $SD = $TICKETSD $Address = $MAIL $Subject = "Votre ticket n° " & $SD & " - Demande de Prêt de PC Portable" $Body = "Bonjour," & @CRLF & @CRLF & _ "Votre demande de prêt de pc portable a bien été prise en compte." & @CRLF & @CRLF & _ "Vous pouvez le retirer dès le " & $DU0 & " à l’accueil du bâtiment ." & @CRLF & @CRLF & _ "Nous attendons son retour pour le " & $AU0 & "." & @CRLF & @CRLF & _ "Cordialement." _INetMail($address, $subject, $body) EndFunc Edited November 26, 2012 by YoannMorl Link to comment Share on other sites More sharing options...
water Posted November 26, 2012 Share Posted November 26, 2012 You could generate a HTML mail. What's your mail client? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
YoannMorl Posted November 26, 2012 Author Share Posted November 26, 2012 (edited) We are using Outlook. I've tried with the outlook UDF, and it works but i can't specify the sender name or sender account if you have an idea too ^^ Edited November 26, 2012 by YoannMorl Link to comment Share on other sites More sharing options...
water Posted November 26, 2012 Share Posted November 26, 2012 You can use the "SentOnBehalfOfName" property. The wiki describes how to do. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
YoannMorl Posted November 26, 2012 Author Share Posted November 26, 2012 (edited) I don't understand how the EX UDF works. Don't understand what is Item ID and how to use it. Item ID is stored in $oItem ? Cause i have 3 accounts on my outlook. 2 generic account and 1 personnal. I'd like to send a mail with 1 of the genreic account that is not set to default. Edited November 26, 2012 by YoannMorl Link to comment Share on other sites More sharing options...
water Posted November 26, 2012 Share Posted November 26, 2012 Correct. You create a mail item by calling _OL_ItemCreate. The function returns the object of the created item. You then pass this "ID" to all other functions because they need to know which object to process. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
jmon Posted November 26, 2012 Share Posted November 26, 2012 (edited) [edit] are the special characters converted to question marks? did you try converting to UTF? I think Autoit sends strings in unicode by default. Try something like this before sending your data (this one converts to UTF16): _INetMail($address, $subject, BinaryToString(StringToBinary($body, 2), 2)) maybe try to convert to UTF8 too if it doesn't work Edited November 26, 2012 by jmon [center]www.jmontserrat.comFile Sequence UDF - _StringExtractPaths - _StringTrimPattern - GuiCtrlSetOnTop - CalendarUDF[/center] Link to comment Share on other sites More sharing options...
YoannMorl Posted November 26, 2012 Author Share Posted November 26, 2012 (edited) @Water Ok, i've tried but. I'm not satisfied. Cause i'd like the mail show before send it. I'd like to be able to verify the content of the mail and click on send if it's ok. I just need to modify my script to have special chars working and to specify from who is sending the mail. The UDF correct my problem with chars but with the ex and thi wiki example, i have the error that i've not the authorisation to send on behalf of. @jmon Yes, chars a replaced by ? or are just simply bypassed Not working with _INetMail($address, $subject, BinaryToString(StringToBinary($body, 2), 2)) or _INetMail($address, $subject, BinaryToString(StringToBinary($body, 4), 4)) Edited November 26, 2012 by YoannMorl Link to comment Share on other sites More sharing options...
water Posted November 26, 2012 Share Posted November 26, 2012 If you just want to create the mail and display it before sending use the following code: #include <OutlookEx.au3> ; Open the connection to Outlook Global $oOL = _OL_Open() ; Create a mail item and set some properties Global $oItem = _OL_ItemCreate($oOL, $olMailItem, "*\Outlook-UDF-Test\TargetFolder\Mail", "", _ "Subject=TestMail", "BodyFormat=" & $olFormatHTML, "HTMLBody=Bodytext in <b>Test</b>.", "SentOnBehalfOfName=Doe Jane") ; Add a recipient and resolve it _OL_ItemRecipientAdd($oOL, $oItem, Default, $olTo, "Doe John") ; Display the mail $oItem.Display() My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
YoannMorl Posted November 26, 2012 Author Share Posted November 26, 2012 I've tried it but it returns me an error : expandcollapse popupCOM Error Encountered in MAIL.AU3 OutlookEx UDF version = 0.9.0 @AutoItVersion = 3.3.8.1 @AutoItX64 = 0 @Compiled = 0 @OSArch = X64 @OSVersion = WIN_7 Scriptline = 1211 NumberHex = 80020009 Number = -2147352567 WinDescription = Description = Échec de l’opération. Impossible de trouver un objet. Source = Microsoft Outlook HelpFile = HelpContext = 0 LastDllError = 0 ======================================================== COM Error Encountered in MAIL.AU3 OutlookEx UDF version = 0.9.0 @AutoItVersion = 3.3.8.1 @AutoItX64 = 0 @Compiled = 0 @OSArch = X64 @OSVersion = WIN_7 Scriptline = 3075 NumberHex = 80020009 Number = -2147352567 WinDescription = Description = Impossible d'ouvrir l'élément. Recommencez. Source = Microsoft Outlook HelpFile = HelpContext = 0 LastDllError = 0 ======================================================== COM Error Encountered in MAIL.AU3 OutlookEx UDF version = 0.9.0 @AutoItVersion = 3.3.8.1 @AutoItX64 = 0 @Compiled = 0 @OSArch = X64 @OSVersion = WIN_7 Scriptline = 18 NumberHex = 000000A9 Number = 169 WinDescription = Variable must be of type 'Object'. Description = Impossible d'ouvrir l'élément. Recommencez. Source = Microsoft Outlook HelpFile = HelpContext = 0 LastDllError = 0 ======================================================== Link to comment Share on other sites More sharing options...
water Posted November 26, 2012 Share Posted November 26, 2012 Can you post the code you use? My example above has to be modified because at least "*Outlook-UDF-TestTargetFolderMail" doesn't work 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 - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted November 26, 2012 Share Posted November 26, 2012 Change "*Mail" to "*Drafts" (or whatever the name of your drafts folder is). My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
YoannMorl Posted November 26, 2012 Author Share Posted November 26, 2012 (edited) Ok it works. Thanks. Need to verify the language of outlook before to avoid error in folder name. Another things it's that i don't want to set on every user of this script the ability to send on behalf of for the mailbox i set. The generic mailbox is mounted in outlook and user can send mail from them. Is there a way to speciofy wich account to use and not on behalf of ? Edited November 26, 2012 by YoannMorl Link to comment Share on other sites More sharing options...
water Posted November 26, 2012 Share Posted November 26, 2012 (edited) If you need a language independant script then have a look at _OL_FolderAccess. There you can specify the type of folder you want to access without the need to specify its name. $aFolder = _OL_FolderAccess($oOutlook, "", $olFolderDrafts) ; Create a mail item and set some properties Global $oItem = _OL_ItemCreate($oOL, $olMailItem, $aFolder[1], "", _ "Subject=TestMail", "BodyFormat=" & $olFormatHTML, "HTMLBody=Bodytext in <b>Test</b>.", "SentOnBehalfOfName=abc xyz") Edited February 8, 2014 by Jos remove name My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
YoannMorl Posted November 26, 2012 Author Share Posted November 26, 2012 (edited) Another things it's that i don't want to set on every user of this script the ability to send on behalf of for the mailbox i set. The generic mailbox is mounted in outlook and user can send mail from them. Is there a way to speciofy wich account to use and not on behalf of ? Edited November 26, 2012 by YoannMorl Link to comment Share on other sites More sharing options...
water Posted November 26, 2012 Share Posted November 26, 2012 How do you manually specify that you want to send the mail from the generic mailbox? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
YoannMorl Posted November 26, 2012 Author Share Posted November 26, 2012 (edited) In outlook, i can change the from line when a create a new mail. A the top of the window, i have a dropdown list with all accounts. Id like to force user to use a specific mail (from) by default. Edited November 26, 2012 by YoannMorl Link to comment Share on other sites More sharing options...
water Posted November 26, 2012 Share Posted November 26, 2012 You need to set the Originator like this: ; Set the Originator of the mail and resolve it _OL_ItemRecipientAdd($oOL, $oItem, Default, $olOriginator, "resolveable name of the sender") My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
YoannMorl Posted November 26, 2012 Author Share Posted November 26, 2012 Tried but it's seems to not working, i stay the sender of the mail. Link to comment Share on other sites More sharing options...
water Posted November 26, 2012 Share Posted November 26, 2012 This will take some time because I need to do some tests. Will come back as soon as I have a result ... My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
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