Cesar
Wish it was that simple in XP .. I can "Run As" on the executable but not on the .bat file
Rick Lipkin
METHOD LoadIni( cFile ) CLASS TPresencia
Local oIni
INI oIni FILE ".\" + cFile
GET ::smtpServer SECTION "MAIL" ENTRY "SMTPSERVER" OF oIni DEFAULT ""
GET ::smtpPort SECTION "MAIL" ENTRY "PORT" OF oIni DEFAULT 25
GET ::sendusing SECTION "MAIL" ENTRY "SENDUSING" OF oIni DEFAULT 2
GET ::username SECTION "MAIL" ENTRY "USER" OF oIni DEFAULT ""
GET ::password SECTION "MAIL" ENTRY "PASSWORD" OF oIni DEFAULT ""
GET ::AUTH SECTION "MAIL" ENTRY "AUTH" OF oIni DEFAULT 1
GET ::SSL SECTION "MAIL" ENTRY "SSL" OF oIni DEFAULT .T.
GET ::TimerOut SECTION "MAIL" ENTRY "TIMEROUT" OF oIni DEFAULT 10
GET ::Copia_Oculta SECTION "MAIL" ENTRY "COPIAOCULTA" OF oIni DEFAULT ""
GET ::Con_Copia SECTION "MAIL" ENTRY "CONCOPIA" OF oIni DEFAULT ""
GET ::GENERIC_TEXT SECTION "MAIL" ENTRY "TEXTO" OF oIni DEFAULT ""
GET ::FROM SECTION "MAIL" ENTRY "FROM" OF oIni DEFAULT ""
GET ::CUERPO SECTION "MAIL" ENTRY "TEXTBODY" OF oIni DEFAULT ""
ENDINI
RETURN NIL
******************************************************************************************
METHOD SendMail() CLASS TPresencia
******************************************************************************************
Local oError, oEmailCfg, oEmailMsg , cFile
TRY
oEmailCfg := CREATEOBJECT( "CDO.Configuration" )
WITH OBJECT oEmailCfg:Fields
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value := ::smtpServer
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value := ::smtpPort
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value := ::sendusing // Remote SMTP = 2, local = 1
// smtpauthenticate
// 0 cdoAnonymous Perform no authentication.
// 1 cdoBasic Use the basic (clear text) authentication mechanism.
// 2 cdoNTLM Use the NTLM authentication mechanism.
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := ::AUTH // 0 , 1 ,2
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := ::SSL
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value := ::username
:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value := ::Password
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"):Value := ::TimerOut
:Update()
END WITH
CATCH oError
? "---->Error en la configuracion"
END
oError := NIL
TRY
oEmailMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT oEmailMsg
:Configuration = oEmailCfg
:From := ::FROM
:To := ::email // <----- Coloca tu dirección de correo
:CC := ::Con_Copia // Con copia
:BCC := ::Copia_Oculta // Con Copia Oculta
:Subject := ::Asunto // Asunto
// :MDNRequested = .T. // Solicitud de reconocimiento, o acuse de recibo
:TextBody := ::Cuerpo
for each cFile in ::aFiles
:AddAttachment( cfile )
next
:Fields:update()
:Send()
// ? "[ "+Time()+" ] Enviado correo :"+ ::email
END
CATCH oError
? "---->Error en el envio del mensaje:"+ oError:Description
END
oEmailCfg := NIL
oEmailMsg := NIL
SysRefresh()
Return .T.
thefull wrote:I using CDO with gmail with SSL , i don't have problems.
- Code: Select all Expand view
METHOD LoadIni( cFile ) CLASS TPresencia
Local oIni
INI oIni FILE ".\" + cFile
GET ::smtpServer SECTION "MAIL" ENTRY "SMTPSERVER" OF oIni DEFAULT ""
GET ::smtpPort SECTION "MAIL" ENTRY "PORT" OF oIni DEFAULT 25
GET ::sendusing SECTION "MAIL" ENTRY "SENDUSING" OF oIni DEFAULT 2
GET ::username SECTION "MAIL" ENTRY "USER" OF oIni DEFAULT ""
GET ::password SECTION "MAIL" ENTRY "PASSWORD" OF oIni DEFAULT ""
GET ::AUTH SECTION "MAIL" ENTRY "AUTH" OF oIni DEFAULT 1
GET ::SSL SECTION "MAIL" ENTRY "SSL" OF oIni DEFAULT .T.
GET ::TimerOut SECTION "MAIL" ENTRY "TIMEROUT" OF oIni DEFAULT 10
GET ::Copia_Oculta SECTION "MAIL" ENTRY "COPIAOCULTA" OF oIni DEFAULT ""
GET ::Con_Copia SECTION "MAIL" ENTRY "CONCOPIA" OF oIni DEFAULT ""
GET ::GENERIC_TEXT SECTION "MAIL" ENTRY "TEXTO" OF oIni DEFAULT ""
GET ::FROM SECTION "MAIL" ENTRY "FROM" OF oIni DEFAULT ""
GET ::CUERPO SECTION "MAIL" ENTRY "TEXTBODY" OF oIni DEFAULT ""
ENDINI
RETURN NIL
******************************************************************************************
METHOD SendMail() CLASS TPresencia
******************************************************************************************
Local oError, oEmailCfg, oEmailMsg , cFile
TRY
oEmailCfg := CREATEOBJECT( "CDO.Configuration" )
WITH OBJECT oEmailCfg:Fields
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value := ::smtpServer
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value := ::smtpPort
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value := ::sendusing // Remote SMTP = 2, local = 1
// smtpauthenticate
// 0 cdoAnonymous Perform no authentication.
// 1 cdoBasic Use the basic (clear text) authentication mechanism.
// 2 cdoNTLM Use the NTLM authentication mechanism.
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := ::AUTH // 0 , 1 ,2
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := ::SSL
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value := ::username
:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value := ::Password
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"):Value := ::TimerOut
:Update()
END WITH
CATCH oError
? "---->Error en la configuracion"
END
oError := NIL
TRY
oEmailMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT oEmailMsg
:Configuration = oEmailCfg
:From := ::FROM
:To := ::email // <----- Coloca tu dirección de correo
:CC := ::Con_Copia // Con copia
:BCC := ::Copia_Oculta // Con Copia Oculta
:Subject := ::Asunto // Asunto
// :MDNRequested = .T. // Solicitud de reconocimiento, o acuse de recibo
:TextBody := ::Cuerpo
for each cFile in ::aFiles
:AddAttachment( cfile )
next
:Fields:update()
:Send()
// ? "[ "+Time()+" ] Enviado correo :"+ ::email
END
CATCH oError
? "---->Error en el envio del mensaje:"+ oError:Description
END
oEmailCfg := NIL
oEmailMsg := NIL
SysRefresh()
Return .T.
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusetls" ):Value := .T.
thefull wrote:Buenas
Yo no he usado nunca TLS, pero puedes probar esto a ver si te funciona ?
- Code: Select all Expand view
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusetls" ):Value := .T.
Saludos
andaretor wrote:Hola:
Soy Andrés Arenas, he estado bastante tiempo aislado y he vuelto a retomar la programación con Fivewin. Tengo una rutina para envío de correos masivos con jMail pero como me daba problemas con 64 bits y me he decantado por CDOSYS. El problema que me encuentro es que copiando el procedimiento que ha pegado The Full me sale el siguiente error:
No se pudo enviar el mensaje
Error: 1001
SubC: 3
OSCode: 0
SubSystem: CDO.Message
Mensaje: DISP_E_MEMBERNOTFOUND
Utilizo windows 7 de 64 bits. ¿Es necesario algún componente adicional? ¿Con que versión de FW y BCC se puede usar?
Un saludo.
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 29 guests