email - How to display Microsoft Outlook mail content using the _IECreateEmbeded function? -
i working on designing functional automation software job using autoit. going great i've run little issue using _iecreateembedded function.
my issue:
what part of program supposed embed microsoft outlook's webpage inside of gui. part works fine. webpage loaded fine , displayed should be. able view message titles , subjects on left side of screen normal, however, when click on message open read, nothing happens. unable compose new message or search inbox. assumed had outlook using script autoit doesn't commonly support, i'm not entirely sure. tried loaded gmail gui , works perfectly. ideas?
here's current code: (the important parts @ least)
; includes #include <guiconstantsex.au3> #include <ie.au3> #include <windowsconstants.au3> ; create gui window $windowmain = guicreate("embedded outlook client", 1001, 701, 242, 88, bitor($ws_maximizebox,$ws_minimizebox,$ws_sysmenu,$ws_caption,$ws_popup,$ws_popupwindow,$ws_group,$ws_tabstop,$ws_border,$ws_clipsiblings)) ; display gui guisetstate(@sw_show) ; create outline embedded browser $guiemailgroup = guictrlcreategroup("", 8, 48, 801, 601) ; initiate function local $oie = _iecreateembedded() ; created embedded browser $browserobj = guictrlcreateobj($oie, 20, 60, 780, 580) ; allow browser resized if window maximized. guictrlsetresizing ( $browserobj, $gui_dockauto) ; navigate outlook _ienavigate($oie, "https://outlook.office.com/owa/#path=/mail") while 1 $nmsg = guigetmsg() switch $nmsg case $gui_event_close exit endswitch wend
note: need outlook account able solution. appreciated. thank in advance!
this simple example of sending email cdo.message
func _inetsmtpmailcom($s_smtpserver, $s_fromname, $s_fromaddress, $s_toaddress, $s_subject = "", $as_body = "", $s_attachfiles = "", $s_ccaddress = "", $s_bccaddress = "", $s_importance = "normal", $s_username = "", $s_password = "", $ipport = 25, $ssl = 0) local $objemail = objcreate("cdo.message") $objemail.from = '"' & $s_fromname & '" <' & $s_fromaddress & '>' $objemail.to = $s_toaddress ; $objemail.to local $i_error = 0 local $i_error_desciption = "" if $s_ccaddress <> "" $objemail.cc = $s_ccaddress if $s_bccaddress <> "" $objemail.bcc = $s_bccaddress $objemail.subject = $s_subject if stringinstr($as_body, "<") , stringinstr($as_body, ">") $objemail.htmlbody = $as_body else $objemail.textbody = $as_body & @crlf endif if $s_attachfiles <> "" local $s_files2attach = stringsplit($s_attachfiles, ";") $x = 1 $s_files2attach[0] $s_files2attach[$x] = _pathfull($s_files2attach[$x]) ;~ consolewrite('@@ debug : $s_files2attach[$x] = ' & $s_files2attach[$x] & @lf & '>error code: ' & @error & @lf) ;### debug console if fileexists($s_files2attach[$x]) consolewrite('+> file attachment added: ' & $s_files2attach[$x] & @lf) $objemail.addattachment($s_files2attach[$x]) else consolewrite('!> file not found attach: ' & $s_files2attach[$x] & @lf) seterror(1) return 0 endif next endif $objemail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objemail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_smtpserver if number($ipport) = 0 $ipport = 25 $objemail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $ipport ;authenticated smtp if $s_username <> "" $objemail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objemail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_username $objemail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_password endif if $ssl $objemail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true endif ;update settings $objemail.configuration.fields.update ; set email importance switch $s_importance case "high" $objemail.fields.item("urn:schemas:mailheader:importance") = "high" case "normal" $objemail.fields.item("urn:schemas:mailheader:importance") = "normal" case "low" $objemail.fields.item("urn:schemas:mailheader:importance") = "low" endswitch $objemail.fields.update ; sent message $objemail.send if @error seterror(2) return $omyret[1] endif $objemail = "" endfunc ;==>_inetsmtpmailcom ; com error handler func myerrfunc() $hexnumber = hex($omyerror.number, 8) $omyret[0] = $hexnumber $omyret[1] = stringstripws($omyerror.description, 3) consolewrite("### com error ! number: " & $hexnumber & " scriptline: " & $omyerror.scriptline & " description: " & $omyret[1] & @lf) seterror(1); check when function returns return endfunc ;==>myerrfunc
now if want build email client don't know how help. other alternative winhttp.
Comments
Post a Comment