Alaska Software Inc. - Send email with ActiveX and Outlook
Username: Password:
AuthorTopic: Send email with ActiveX and Outlook
César Calvo Send email with ActiveX and Outlook
on Mon, 20 Apr 2015 09:29:57 +0200
Hello.
I get send message in one portatil but with other there is a error.
This is the code and the error is attachment:

PROCEDURE ENVIO
LOCAL olApp, oMail, oAttach, cCon1, oCon1, cSEL, oCur1, cNOM, cTXT, oMail1, 
B, cEMA, cFot
LOCAL oCdo, mPara, mDe, mAsunto, mMensaje
LOCAL lcSchema, loConfig, loMsg, loError, lcErr,lcFile, oPro
LOCAL cCorreo, cDesde, cEmis, oEmail, cSer1, cPas1, cAsunto, cCuerpo, 
cPathc, cArc2, lOk, cSend
LOCAL cFIL, cDIR, oSrv, cOut, cLin, cTar, lExe, cFileName, oReg, uDat1, 
uDat2, uDat3
LOCAL cRut, cEMA1, cEMA2, cFile, cStart
LOCAL cHit


cEMA1 := "ccalvoc1965@hotmail.com"
cEMA2 := "ccalvoc@telefonica.net"
cHit := "C:\Program Files (x86)\Microsoft Office\Office14\Outlook.exe"



cRUT := 'D:\IPLACEA\cronicas.docx'

olApp := CreateObject("Outlook.Application")

oMail := olApp:CreateItem( olMailItem )

oMail:Recipients:Add(cEMA1)

IF cEMA2 != "NO"

   oMail:Cc := cEMA2

ENDIF

oMail:Subject := '000_ETE_BDE_RESUMEN'

oMail:Body := "Message body"

IF Time() < "14:00"

   cTXT := "Buenos días," + CHR(10)
   cTXT += CHR(10)
   cTXT += "enviamos información relativa a las operaciones de transacciones 
con el exterior "
   cTXT += "para informar a Banco de España correspondientes al periodo 
201501"
   cTXT += CHR(10) + "Un saludo."
   cTXT += CHR(10) + "_________________________________________"
   cTXT += CHR(10) + "TGestiona España"
   cTXT += CHR(10) + "Gerencia de Tesorería"
   cTXT += CHR(10) + "Jefatura de Operaciones"
   cTXT += CHR(10) + "_________________________________________"

   cTXT := ConvToOemCP(cTXT)

   oMail:Body := cTXT

   ELSE

   cTXT := "Buenas tardes," + CHR(10)
   cTXT += CHR(10)
   cTXT += "enviamos información relativa a las operaciones de transacciones 
con el exterior "
   cTXT += "para informar a Banco de España correspondientes al periodo 
201501"
   cTXT += CHR(10) + "Un saludo."
   cTXT += CHR(10) + "_________________________________________"
   cTXT += CHR(10) + "TGestiona España"
   cTXT += CHR(10) + "Gerencia de Tesorería"
   cTXT += CHR(10) + "Jefatura de Operaciones"
   cTXT += CHR(10) + "_________________________________________"

   cTXT := ConvToOemCP(cTXT)

   oMail:Body := cTXT

ENDIF

oAttach := oMail:Attachments
oAttach:Add(cRUT)

oMail:Send

olApp:Destroy()

RunShell( "", cHit )

RETURN

Regards.
César.


XERR000.TXT
Itai Ben-ArtziRe: Send email with ActiveX and Outlook
on Sun, 10 May 2015 23:44:18 -0700
César,
First: try to validate the outlook object has been instantiated:
olApp := CreateObject("Outlook.Application")
IF Empty(olApp )
  Do something
Endif

Second: olMailItem must be set before used:
olMailItem := 0
oMail := olApp:CreateItem( olMailItem )

-Itai
CESAR CALVORe: Send email with ActiveX and Outlook
on Tue, 12 May 2015 22:58:53 +0200
Thanks Itai but says error:

Invalid value

César.

"Itai Ben-Artzi" escribió en el mensaje de 
noticias:2ae0bda$67c18030$773b7@news.alaska-software.com...

César,
First: try to validate the outlook object has been instantiated:
olApp := CreateObject("Outlook.Application")
IF Empty(olApp )
  Do something
Endif

Second: olMailItem must be set before used:
olMailItem := 0
oMail := olApp:CreateItem( olMailItem )

-Itai
Schung OhhRe: Send email with ActiveX and Outlook
on Tue, 12 May 2015 23:23:30 +0200
> oMail := olApp:CreateItem( olMailItem )

#define olMailItem      0