Jump to content
Fivewin Brasil

erro abrir o outlook


edutraini

Recommended Posts

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)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...