edutraini Posted June 24, 2021 Report Share Posted June 24, 2021 Bom pessoal Eu uso essa rotina abaixo (rmail) que peguei no forum para mandar email Quando o outlook esta fechado ele funciona perfeitamente mas quando o outlook esta aberto na maquina ele da erro Alguem poderia me dar alguma dica como resolver Obrigado Time from start: 0 hours 0 mins 32 secs Error occurred at: 24/06/2021, 11:32:38 Error description: Error TOleAuto/65535 : TOLEAUTO:NEW Args: [ 1] = C Outlook.Application Stack Calls =========== Called from: => THROW( 0 ) Called from: source\rtl\win32ole.prg => TOLEAUTO:NEW( 0 ) Called from: C:\fontes\ACO32_2016\FONTES\NfeFlexdocs.prg => MMAIL( 12450 ) Called from: C:\fontes\ACO32_2016\FONTES\ENVIANFE.000 => EMAILDANFE( 866 ) Called from: C:\fontes\ACO32_2016\FONTES\paconfe5.prg => EMAINFE3( 3200 ) Called from: C:\fontes\ACO32_2016\PRG\pacofat0.prg => (b)BRWBTNBAR( 297 ) Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 704 ) Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 990 ) Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONDOWN( 928 ) Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1788 ) Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 2030 ) Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 ) Called from: => WINRUN( 0 ) Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1097 ) Called from: C:\fontes\ACO32_2016\PRG\sistema.prg => MAIN( 299 ) function Mmail(cTo,cSentBy,cEmailHeader,cEmailNotes,cANEXO1,cToCco) oOutLook := TOleAuto():New("Outlook.Application") oMailItem := oOutLook:Invoke("CreateItem", 0) oMailitem:to:=cTo oMailitem:CC:= cSentBy oMailItem:Subject := cEmailHeader oMailItem:Body := cEmailNotes if ! empty(cANEXO1) IF VALTYPE(cANEXO1) == "C" oMailItem:Attachments:Add(cANEXO1) ELSEIF VALTYPE(cANEXO1) == "A" FOR _i := 1 TO LEN(cANEXO1) oMailItem:Attachments:Add( cANEXO1[_i] ) NEXT ENDIF endif oMailItem:display(.T.) RETURN(nil) Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 24, 2021 Report Share Posted June 24, 2021 Mira se ayuda: // \SAMPLES\EDUTRAIN.PRG - 24/05/2021 - Covid-19 // Mira: // -> http://forums.fivetechsupport.com/viewtopic.php?f=3&t=29820&p=168962&hilit=oMail%3ADisplay+%3D+.T. FUNCTION Mmail( cTo, cSentBy, cEmailHeader, cEmailNotes, cANEXO1, cToCco ) LOCAL oOutLook TRY oOutLook := TOleAuto():New( "Outlook.Application" ) // OU: // oOutlook := GetActiveObject( "Outlook.Application" ) CATCH Msginfo ( "Hello Friend! ERROR in OutLook!" ) RETURN( .F. ) END TRY IF oOutLook == nil hb_Alert( 'OutLook no está Operacional! Instale.', 'Error' ) RETURN NIL ELSE oMailItem := oOutLook:Invoke( "CreateItem", 0 ) oMailitem:TO := cTo oMailitem:CC := cSentBy oMailItem:Subject := cEmailHeader oMailItem:Body := cEmailNotes IF .NOT. Empty( cANEXO1 ) IF ValType( cANEXO1 ) == "C" oMailItem:Attachments:Add( cANEXO1 ) ELSEIF ValType( cANEXO1 ) == "A" FOR _i := 1 TO Len( cANEXO1 ) oMailItem:Attachments:Add( cANEXO1[ _i ] ) NEXT ENDIF ENDIF ENDIF oMailItem:Display( .T. ) RETURN NIL // Fim / End - By kapiabafwh@gmail.com Quote Link to comment Share on other sites More sharing options...
edutraini Posted June 24, 2021 Author Report Share Posted June 24, 2021 Kapi obrigado pela dica eu fiz o teste aqui pelo menos agora da a mensagem Mas ainda continuo sem solucao se o outlook esta aberto o email nao sobe o usuario tem que fechar o outlook para poder subir o email Precisava descobrir um jeito de mandar o email mesmo que o outlook esteja aberto afinal e normal deixar o outlook aberto na maquina So um detalhe esse erro so acontece no outlook microsoft 365 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 25, 2021 Report Share Posted June 25, 2021 Tente desligar o OutLook antes com taskkill /F /IM OutLook.exe Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 25, 2021 Report Share Posted June 25, 2021 outlook microsoft 365, a conta é PAGA? o outlook microsoft 365 grátis, tem limite de envio de emails, se for o grátis, melhor não usar, indique ao cliente para comprar o pacote pago ou usar um provedor grátis, tipo o gmail.com. abs. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 25, 2021 Report Share Posted June 25, 2021 Em tempo, o gmail.com também tem a parte paga, mas isso, é se o volume de emails for muito grande, tipo: 500 por dia, +-, ai, só se informando com o suporte do google. O pago, é ilimitado como o da Microsoft. Abs. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.