FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour SendMail
Posts: 1380
Joined: Fri Oct 14, 2005 01:28 PM
SendMail
Posted: Mon Oct 27, 2008 01:46 PM
Estimados:
hace un tiempo alguien dejó, en el foro, este código:
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     := 0 // None (Default)
   local nCounter
   local lSentOk
   local cSubject    := "SendMail desde FWxH..."
   local cText       := "Mario;"+CRLF+"Aca va el SendMail; enviado Self (a si mismo :-)"
   local cSendTo     := 'mario.r.gonzalez@gmail.com'
   local cMailFrom   := 'mgonzalez@ing.unne.edu.ar'
   local xReturn

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

   if lNeedsAuth
      oMail:AuthenticationType := 2
      oMail:Password    := ''
      oMail:Username    := ''
      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 := { 'sendmail.rar' }

   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 )


El que funciona Ok. La consulta es: A la variable nNotify:= 0 // None (Default) la cambio por 1 interpretando que podría ser el valor para recibir la notificación de recibido; pero ello no ocurre.
Alguien sabe decirme cual el valor correcto o que debería usar para que retorne un Notify?

muchas gracias
Resistencia - "Ciudad de las Esculturas"

Chaco - Argentina

Continue the discussion