Página 1 de 1

TCDOMAIL y Yahoo

Publicado: Dom Abr 03, 2022 10:25 am
por XeviCOMAS
Estoy intentando hacer funcionar el envio de mails para distintos servidores smtp, pero para el servidor Yahoo tengo problemas y no termina de funcionar correctamente.

Código: Seleccionar todo

   WITH OBJECT TCDOMail():New()
   :cSubject      := "PRUEBA"
   :cFrom         := "mimail@yahoo.com"
   :cUser         := "mimail@yahoo.com"
   :cPassword     := "miclaveapps"
   :cServer       := "smtp.mail.yahoo.com"
   :nPort         := 465
   :lAuthenticate := .T.
   :lSSL          := .T.

//Si no relleno estos campos me deja los mails en Borradores, y veo que "rellena" CC y BCC con campo vacío pero lo muestra en rojo de "error"
:cCC := "_@hotmail.com"  //Debo poner un mail Con Copia
:cBCC := "-@yahoo.com"//"-@hotmail.com" //Debo poner un mail Con Copia Oculta (distinto al CC)

   :cTO           := "mimail@gmail.com"
*   :lHTML         := ::oHtml:lChecked
   :cMessage      := "Texto de prueba"
*   :aAttachments  := { cFile }
   :Create()

   If :Send()
      MsgInfo( "OK", "ENVIO", mbOK,, IDI_INFORMATION )
   Else
      MsgStop( "KO", "ERROR", mbOK,, IDI_ERROR )
   EndIf
   END
Como comento, si no relleno los DOS campos cCC y cBCC con algun mail, salta a ERROR y Yahoo deja el mensaje en la carpeta Borradores.

¿Alguien está utilizando TCDOMAIL con algun cliente que utilize el servidor de correo de Yahoo???

Re: TCDOMAIL y Yahoo

Publicado: Lun May 02, 2022 12:19 pm
por bingen
Lo siento Xevi, pero precisamente dejamos de usar CDO por que no nos funcionaba con ciertos servidores , por ejemplo aquellos que usan TTLS.
Ahora usamos cosas más "sofisticadas" como enviar con una clase de la librería de pago ChilKat aunque también hay una utilidad gratuita en línea de comandos SwithMail que funciona de maravilla.

Si te interesa cualquier aclaración sobre estas me las pides.

Re: TCDOMAIL y Yahoo

Publicado: Lun Jun 20, 2022 8:12 pm
por Luisen_xlr
Puedes brindarme ayuda referente a SwithMail de preferencia, siendo usado por Xailer. ?

Gracias de Antemano

Re: TCDOMAIL y Yahoo

Publicado: Lun Jun 27, 2022 5:52 pm
por gabo1
Hola Luisen
Yo lo uso de esta manera.. quizas hay otros parmetros y mejores implementaciones pero por el momento me funciona

Código: Seleccionar todo

  IF Hb_FileExists( Application:cDirectory + "SwithMail\template_og.html" )
     xTemplate:= HB_MemoRead( Application:cDirectory + "SwithMail\template_og.html" )
     xTemplate:= StrTran( xTemplate, "#FOLIO_FACTURA#", ::cFolioFactura )
     xTemplate:= StrTran( xTemplate, "#NOMBRE_CLIENTE#", ::cNOM_Cliente )
     xTemplate:= StrTran( xTemplate, "#FECHA_HORA_FACTURA#", ::dFAC_FechaHora )
     xTemplate:= StrTran( xTemplate, "#NOMBRE_RESTAURANT#", AppData:cNameCompany )
     xTemplate:= StrTran( xTemplate, "#TELEFONOS#", ::cTEL_Empresa )
     xTemplate:= StrTran( xTemplate, "#EMAIL_EMISOR#", ::oSMTP_UserName:Value )
     xTemplate:= StrTran( xTemplate, "#LOGO_OREGANO#", cImgOG )
     xTemplate:= StrTran( xTemplate, "#LOGO_EMPRESA#", cImgCo )
     HB_MemoWrit( Application:cDirectory + "SwithMail\template_tmp.html", xTemplate )
  ENDIF
  cPlantilla:= HB_MemoRead( Application:cDirectory + "SwithMail\template_tmp.html" )
  // cXMLFile:= Application:cDirectory + 'SwithMail\SwithMailSettings.xml'

  hXML:= mxmlNewXML( "1.0" )
  hPtr:= mxmlNewElement( hXML, "SwithMailSettings" )

  hServer:= mxmlNewElement(hPtr, "ServerSettings")
        hNode:= mxmlNewElement(hServer, "FromName" )
        mxmlNewText( hNode, 0, AppData:cNameCompany )
        hNode:= mxmlNewElement(hServer, "FromAddress" )
        mxmlNewText( hNode, 0,AllTrim(::oED_Remitente:Value) )
        hNode:= mxmlNewElement(hServer, "Username" )
        mxmlNewText( hNode, 0, AllTrim(::oED_Remitente:Value) )
        hNode:= mxmlNewElement(hServer, "Password" )
        mxmlNewText( hNode, 0, AllTrim(::oSMTP_Password:Value) )
        hNode:= mxmlNewElement(hServer, "ObscurePassword" )
        mxmlNewText( hNode, 0, "False" )
        hNode:= mxmlNewElement(hServer, "MailServer" )
        mxmlNewText( hNode, 0, AllTrim(::oSMTP_Server:Value) )
        hNode:= mxmlNewElement(hServer, "MailServerPort" )
        mxmlNewText( hNode, 0, AllTrim(Str(::oSMTP_Port:Value)) )
        hNode:= mxmlNewElement(hServer, "SSL" )
        mxmlNewText( hNode, 0, IF( ::oRM_SSL:nIndex==1, "True", "False") )
        hNode:= mxmlNewElement(hServer, "RequestReceipt" )
        mxmlNewText( hNode, 0, "False" )
        hNode:= mxmlNewElement(hServer, "MessageID" )
        mxmlNewText( hNode, 0, "False" )

  hEmail:= mxmlNewElement(hPtr, "EmailAddresses")
     hNode:= mxmlNewElement(hEmail, "To" )
     mxmlNewText( hNode, 0, cToEmail )
     hNode:= mxmlNewElement(hEmail, "CC" )
     mxmlNewText( hNode, 0, cCCToEmail )

  hAttach:= mxmlNewElement(hPtr, "Attachments")
     hNode:= mxmlNewElement(hAttach, "AttachmentPath" )
     mxmlNewText( hNode, 0, cFileXML )
     hNode:= mxmlNewElement(hAttach, "AttachmentPath" )
     mxmlNewText( hNode, 0, cFilePDF )

  hConten:= mxmlNewElement(hPtr, "EmailContent")
     hNode:= mxmlNewElement(hConten, "HTML" )
     mxmlNewText( hNode, 0, "True" )
     hNode:= mxmlNewElement(hConten, "DontReplaceNewLine" )
     mxmlNewText( hNode, 0, "False" )
     hNode:= mxmlNewElement(hConten, "Subject" )
     mxmlNewText( hNode, 0, ::oED_Asunto:Value)
     hNode:= mxmlNewElement(hConten, "Body" )
     mxmlNewText( hNode, 0, cPlantilla)
     hNode:= mxmlNewElement(hConten, "Priority" )
     mxmlNewText( hNode, 0, "high")

  hLogg:= mxmlNewElement(hPtr, "Logging")
     hNode:= mxmlNewElement(hLogg, "Log" )
     mxmlNewText( hNode, 0, "True")

  mxmlSaveFile( hPtr, 'SwithMail\SwithMailSend.xml', MXML_NO_CALLBACK )

  cCommand:= Application:cDirectory + 'SwithMail\SwithMail.exe /s /x "'
  cCommand+= Application:cDirectory + 'SwithMail\SwithMailSend.xml"'

  cError:= OpenCommandMsDos(cCommand)