Error ole send mail

Error ole send mail

Postby Wanderson » Fri Sep 24, 2010 6:23 pm

Hi, I get this error in some pcs when i try to send email, i have 10 pcs in network, in 2 works but 8 not.

Application
===========
Path and name: E:\Sistemas\Link\FONTES\transp32.exe (32 bits)
Size: 4,689,408 bytes
Time from start: 0 hours 0 mins 5 secs
Error occurred at: 24/09/2010, 14:47:14
Error description: Error TOleAuto/-1 CO_E_CLASSSTRING: TOLEAUTO:NEW
Args:
[ 1] = C OSSMTP.SMTPSession

Stack Calls
===========
Called from: => THROW(0)
Called from: win32ole.prg => TOLEAUTO:NEW(308)
Called from: win32ole.prg => CREATEOBJECT(67)
Called from: PROG149.PRG => MAILTEST(163)
Called from: => PROCESSA(120)
Called from: PROG149.PRG => (b)PROG149(32)
Called from: BUTTON.PRG => TBUTTON:CLICK(0)
Called from: CONTROL.PRG => TBUTTON:HANDLEEVENT(1326)
Called from: WINDOW.PRG => _FWH(0)
Called from: => SENDMESSAGE(0)
Called from: DIALOG.PRG => TDIALOG:COMMAND(0)
Called from: WINDOW.PRG => TWINDOW:HANDLEEVENT(0)
Called from: DIALOG.PRG => TDIALOG:HANDLEEVENT(0)
Called from: => DIALOGBOX(0)
Called from: DIALOG.PRG => TDIALOG:ACTIVATE(0)
Called from: PROG149.PRG => PROG149(36)
Called from: => HABIL(1134)
Called from: TRANSP.PRG => (b)UTIL(706)
Called from: MENU.PRG => TMENU:ACTIVATE(447)
Called from: TOOLBAR.PRG => TTOOLBAR:NOTIFY(0)
Called from: WINDOW.PRG => TWINDOW:NOTIFY(0)
Called from: WINDOW.PRG => TWINDOW:HANDLEEVENT(0)
Called from: WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: WINDOW.PRG => TWINDOW:ACTIVATE(0)
Called from: TRANSP.PRG => MAIN(190)


My code:

local oMail
local cHost := alltrim(lower(oArqMail:SMTP))
local cPopServer := cHost
local lNeedsAuth := oArqMail:AUTENTICA
local nPriority := 0 // Normal (Default)
local nSensitivity := 0 // Normal (Default)
local nNotify := 0 // None (Default)
local lSentOk
local cSubject
local cText
local cSendTo := alltrim(lower(oArqMail:BACKUP))
local cMailFrom := alltrim(lower(oArqMail:EMAIL))

oMail := CreateObject("OSSMTP.SMTPSession")
oMail:Server := cHost
oMail:RaiseError := .f.

if lNeedsAuth
oMail:AuthenticationType := 2
oMail:Password := alltrim(lower(oArqMail:SENHA))
oMail:Username := alltrim(lower(oArqMail:LOGIN))
oMail:ReplyTo := alltrim(lower(oArqMail:EMAIL))
oMail:POPServer := cPopServer
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 := "Backup do Sistema Link"
oMail:MessageText := "Backup dia: "+Dia+CRLF+"Hora Início: "+Inicio+CRLF+"Hora fim: "+fim

// Attachements *********************************
aFiles := { Nomefin }

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

// Attachements *********************************

oMail:SendEmail()
if upper( oMail:Status ) = 'ERROR'
lSentOk := .t.
else
lSentOk := .f.
endif
oMail := nil
return( lSentOk )


Thanks in advance.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 76 guests