Hace un tiempo atrás, baje del foro, un código para envío de correo-e.
No lo había probado hasta ahora, y me arroja un error.
El codigo es:
Code: Select all
ANNOUNCE RDDSYS
#include "fivewin.ch"
procedure main
if MsgYesNo( "enviar correo?" )
mailtest()
end
//
function mailtest()
local oMail, ;
oAttachment
local aFiles
local cHost := 'ing.unne.edu.ar'
local cPopServer := cHost
local lNeedsAuth := .T.
local nPriority := 0 // Normal (Default)
local nSensitivity:= 0 // Normal (Default)
local nNotify := 2 // None (Default)
local nCounter
local lSentOk
local cSubject := "Se produjo un error en..."
local cText := "Describa el error encontrado"
local cSendTo := 'mario.r.gonzalez@gmail.com'
local cMailFrom := 'mgonzalez@ing.unne.edu.ar'
oMail := CreateObject("OSSMTP.SMTPSession")
oMail:Server := cHost
oMail:RaiseError := .f.
if lNeedsAuth
oMail:AuthenticationType := 2
oMail:Password := 'mipase'
oMail:Username := 'mgonzalez@ing.unne.edu.ar'
oMail:ReplyTo := ''
oMail:POPServer := 'ing.unne.edu.ar'
else
oMail:AuthenticationType := 0 // 0 = no authentication
endif
oMail:Importance := nPriority
oMail:Sensitivity := nSensitivity
// Needs comma seperator so if someone used semicolon change them to commas
oMail:SendTo := trim(strtran( cSendTo, ';', ',' ))
oMail:MailFrom := cMailFrom
oMail:MessageSubject := cSubject // 'My test subject'
oMail:MessageText := cText //'Body of email.'
// Attachements *********************************
aFiles := { 'error.log' }
for nCounter := 1 to len( aFiles )
oAttachment := CreateObject("OSSMTP.Attachment")
oAttachment:FilePath = aFiles[ nCounter ]
oAttachment:AttachmentName = cFileNoPath( aFiles[ nCounter ] )
if file( aFiles[ nCounter ] )
oMail:Attachments:add( oAttachment )
endif
next
oMail:SendEmail()
if upper( oMail:Status ) = 'ERROR'
? oMail:Status
lSentOk := .f.
else
lSentOk := .T.
endif
oMail := nil
return( lSentOk )
Application
===========
Path and name: D:\Fuen32\Pru32\sendmail.exe (32 bits)
Size: 1,201,664 bytes
Time from start: 0 hours 0 mins 3 secs
Error occurred at: 03/05/08, 09:51:45
Error description: Error TOleAuto/-1 CO_E_CLASSSTRING: TOLEAUTO:NEW
Args:
[ 1] = C OSSMTP.SMTPSession
Stack Calls
===========
Called from THROW(0)
Called from TOLEAUTO:NEW(309)
Called from CREATEOBJECT(67)
Called from MAILTEST(29)
Called from MAIN(7)
Alguien me puede orientar sobre el error?
Uso FW 2.6MAY2005 - xHarbour 0.99.60.1
saludos, gracias