karinha wrote:Carlos, que yo recuerde, solo tiene un comando para LECTURA DE CONFIRMACIÓN. AVISO DE RECIBO, nunca lo vi.
Creo que esto es nuevo para los proveedores y creo que no han actualizado CDOSYS.
Regards, saludos.
Enrico Maria Giordano wrote:I would prefer to not use external scripts as there is no control over the whole send operation.
paquitohm wrote:Which control is lost? I do not see that I have lost any control: I send a .ini file as a parameter and the external one generates an entry in that file letting me know if the sending has been successful or not and in case of error it records the description of the error. Powershell/PHP/Python all have recoverable error handling and can be recorded and returned
I don't see the loss of control
What is more worrying to me is the many hours I have dedicated to the topic of CDO using all the tricks on the web to conclude, after many hours, that CDO is not TLS compatible and that most likely hb_sendmail() is not compatible either.
paquitohm wrote:Which control is lost? I do not see that I have lost any control: I send a .ini file as a parameter and the external one generates an entry in that file letting me know if the sending has been successful or not and in case of error it records the description of the error. Powershell/PHP/Python all have recoverable error handling and can be recorded and returned
I don't see the loss of control
What is more worrying to me is the many hours I have dedicated to the topic of CDO using all the tricks on the web to conclude, after many hours, that CDO is not TLS compatible and that most likely hb_sendmail() is not compatible either.
ObjSendMail.DSNOptions = 14
karinha wrote:Carlos, el comando no és este?
- Code: Select all Expand view RUN
ObjSendMail.DSNOptions = 14
Regards, saludos.
FiveWiDi wrote:karinha wrote:Carlos, el comando no és este?
- Code: Select all Expand view RUN
ObjSendMail.DSNOptions = 14
Regards, saludos.
YYYYYYYYYYYYYYYEEEEEEEEEEEEEEEEEEEEEESSSSSSSSSSSSSSSSSSSSSS !!!!!
I LOVE YOU KARINHA !!!!!!!!!!!
oMsg := CREATEOBJECT( "CDO.Message" )
//Traza( 1, "ValType(oMsg)=", ValType(oMsg) )
oMsg:Configuration := oCfg
//Traza( 1, ":" )
IF !EMPTY( cSender )
cFrom := ["] + cSender + ["] + " <" + cFrom + ">"
//Traza( 1, ":" )
ENDIF
oMsg:DSNOptions := 14 /// <<<<<<<<<<<<<<<< AQUÍ ESTÁ !!!!!!
VOY A CELEBRARLO !!!!!!
MUCHAS GRACIAS !!!!!!!
// C:\FWH\SAMPLES\CDOSYS2.PRG - Simples MODEL for HARBOUR.
#include "FiveWin.ch"
FUNCTION Main()
...
...
IF ...
...
PW_EnviaEmail( mPwUser, mPwEmail, mPwNome, mPwPass )
...
ENDIF
...
...
RETURN NIL
// Função para chamada do email:
FUNCTION PW_EnviaEmail( cPwUser, cPwEmail, cPwNome, cPwPass )
LOCAL mRetorno := .T.
// mail Simples nao responda
cTo := AllTrim( cPwEmail )
cSubject := 'FiveWin: Recuperação de Senha'
lConf := .T.
lSSL := .F.
aFiles := {} // pode ser uma matriz com vários endereços
cMsg := 'Simples Informática e Consultoria Ltda'
cMsg += CRLF + 'Sistema de Contabilidade Pública' + CRLF
cMsg += CRLF + 'Recuperação de Senha do Usuário:'
cMsg += CRLF + 'Nome: ' + cPwNome
cMsg += CRLF + 'Usuário: ' + cPwUser
cMsg += CRLF + 'Senha: ' + cPwPass
cMsg += CRLF + 'Email: ' + cPwEmail
mRetorno := Envia_Email( aFiles, cSubject, cTo, cMsg, mEmailServer, ;
mEmailFrom, mEmailUser, mQwer, mEmailPorta, '', '', lCONF, lSSL )
RETURN( mRetorno )
// Função de chamada do CDOSys:
/*
http://www.pctoledo.com.br/forum/viewtopic.php?f=4&t=10764&start=30
http://www.pctoledo.com.br/forum/viewtopic.php?f=2&t=16294&start=15
http://fivewin.com.br/index.php?/topic/26829-erro-ao-enviar-e-mail-via-cdomessage-e-gmail/#comment-278073
https://www.google.com/settings/security/lesssecureapps
https://www.usandoaccess.com.br/tutoriais/enviar-email-usando-o-cdosys.asp
https://stackoverflow.com/questions/3791461/cdo-message-wont-send-when-delivery-receipt-requested
*/
#pragma -w0
#pragma -es0
FUNCTION Envia_email( aFiles, cSubject, cDest, cMsg, cServerIp, cFrom, cUser, ;
cPass, vPORTSMTP, cCC, cBCC, vEMAIL_CONF, wSSL_EMAIL )
LOCAL lRet := .F.
LOCAL oCfg, oError, oMsg
LOCAL lAut := .T.
TRY
oCfg := CREATEOBJECT( "CDO.Configuration" )
WITH OBJECT oCfg:Fields
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value := cServerIp // server SMTP
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value := vPORTSMTP
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value := 2 // Remote SMTP = 2, local = 1
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := 1 //
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := .F. // wSSL_EMAIL // .F. Ou .T.
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value := AllTrim( cUser )
:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value := AllTrim( cPass )
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout" ):Value := 60
:Update()
END WITH
lRet := .T.
CATCH oError
MsgStop( "Não Foi possível Enviar o e-Mail!" + hb_osNewLine() + ;
"Error: " + Transform( oError:GenCode, nil ) + ";" + hb_osNewLine() + ;
"SubC: " + Transform( oError:SubCode, nil ) + ";" + hb_osNewLine() + ;
"OSCode: " + Transform( oError:OsCode, nil ) + ";" + hb_osNewLine() + ;
"SubSystem: " + Transform( oError:SubSystem, nil ) + ";" + hb_osNewLine() + ;
"Mensaje: " + oError:Description, "Atenção" )
END
IF lRet
TRY
oMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT oMsg
:Configuration := oCfg
:FROM := cUser // cFrom
:Sender := cUser // :Sender = "kapaiabafwh@gmail.com"
:TO := cDest
:Subject := cSubject
:TextBody := cMsg
FOR x := 1 TO Len( aFiles )
:AddAttachment( AllTrim( aFiles[ x ] ) )
NEXT
:MDNRequested := .T. // Requiere respuesta
:DSNOptions := 14 // Return a DSN if delivery succeeds, fails, or is delayed.
// :Fields( "urn:schemas:mailheader:disposition-notification-to" ):Value := cFrom //'retorno@simplesinformatica.com.br'
// :Fields( "urn:schemas:mailheader:return-receipt-to" ):Value := cFrom //'retorno@simplesinformatica.com.br'
:Fields( "urn:schemas:httpmail:importance" ):Value := '2'
:Fields:update()
:Send()
END WITH
lRet := .T.
CATCH oError
msg := 'Não Foi Possível Enviar a Mensagem: "' + cSubject + '"' + CRLF
msg += 'Verifique se existe conexão com a Internet.' + CRLF
msg += "Destinatário.: " + cDest + CRLF
msg += "Error.: " + Str( oError:GenCode ) + CRLF
msg += "SubC.: " + Str( oError:SubCode ) + CRLF
msg += "OSCode.: " + Str( oError:OsCode ) + CRLF
msg += "SubSystem.: " + oError:SubSystem + CRLF
msg += "Mensagem.: " + oError:Description + CRLF
msg += "Operação.: [" + oError:Operation + "]" + CRLF
mArgs := oError:Args
msg += "Argumento: " + ValType( mArgs ) + '[' + AllTrim( Str( Len( mArgs ) ) ) + ']' + CRLF
IF ValType( mArgs ) = 'C'
msg += "Argumento: [" + mArgs + "]"
ELSEIF ValType( mArgs ) = 'A'
FOR i = 1 TO Len( mArgs )
msg += Str( i, 1 ) + " [" + mArgs[ i ] + "]" + CRLF
NEXT
ENDIF
MsgInfo( msg )
lRet := .F.
END
ENDIF
oCfg := NIL
oMsg := NIL
RETURN( lRet )
// FIN / END
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 62 guests