Page 1 of 1

About CDOSYS (Collaboration Data Objects) and attachments

Posted: Mon Jun 11, 2012 6:35 pm
by salamandra
Hi to all :) ,
I tested the sample code posted by Daniel Maximiliano using Collaboration Data Objects
and really it worked fine to sending only email without attachments.
viewtopic.php?f=5&t=1518&p=20113#p20113
Anybody knows how to get CDO working properly with attachments ??

TIA,


[]´s Salamandra

Re: About CDOSYS (Collaboration Data Objects) and attachment

Posted: Tue Jun 12, 2012 12:30 am
by danielmaximiliano
Hi / Hola Salamandra :

CdoSys tiene como enviar un archivo adjunto , eh intentado activar dicha funcion pero me da error, estoy investigando cual es la falla,apenas lo resuelva subo la modificacion.

Translate Google

CdoSys is to send an attachment, eh tried to activate this function but I get error, I am researching which is the fault, just upload the modified work it out.
error.jpg
error.jpg (81.13 KiB) Viewed 7508 times

Code: Select all

      loMsg := CREATEOBJECT ( "CDO.Message" )
      WITH OBJECT loMsg
         :Configuration := loCfg
         :From          := Main.cFrom.Value
         :To            := Main.cTo.Value    // <-----       Coloca aqui  tu direcci¢n de correo
         :Subject       := "Prueba con DO"
         :TextBody      := Main.Contenido.Value
         :AddAttachment := "c:\Main.prg"         /*** Lineas a agregar ****/
         :Send()
      ENDWITH
Nota sobre archivos adjuntos : si se desea enviar varios archivos en el mismo mensaje , se debe ejecutar el método para cada archivo, por ejemplo :

CDO.AddAttachment (Adjunto 1)
CDO.AddAttachment (Adjunto 2)
CDO.AddAttachment (Adjunto 3)

... resto de código

Re: About CDOSYS (Collaboration Data Objects) and attachment

Posted: Tue Jun 12, 2012 12:48 am
by danielmaximiliano
CdoSys tiene como enviar un archivo adjunto , eh intentado activar dicha funcion pero me da error, estoy investigando cual es la falla,apenas lo resuelva subo la modificacion.

Translate Google

CdoSys is to send an attachment, eh tried to activate this function but I get error, I am researching which is the fault, just upload the modified work it out.
ya encontre la solucion
mail.jpg
mail.jpg (81.92 KiB) Viewed 7504 times

Code: Select all

      loMsg := CREATEOBJECT ( "CDO.Message" )
      WITH OBJECT loMsg
         :Configuration := loCfg
         :From          := Main.cFrom.Value
         :To            := Main.cTo.Value    
         :Subject       := "Prueba con DO"
         :TextBody      := Main.Contenido.Value
         :AddAttachment("c:\Main.prg")
         :Send()
      ENDWITH
if you need more upload attachments / si se necesitan cargar mas adjuntos

Code: Select all

  :AddAttachment("c:\Main.prg","file2","file3",more,,)

or

 :AddAttachment("c:\Main.prg")
 :AddAttachment("File2")


Re: About CDOSYS (Collaboration Data Objects) and attachment

Posted: Tue Jun 12, 2012 10:16 am
by salamandra
Hi Daniel :) ,
Thanks you for your reply.
I´ll try this way and post result here.


[]´s Salamandra

Re: About CDOSYS (Collaboration Data Objects) and attachment

Posted: Tue Jun 12, 2012 3:15 pm
by salamandra
Hi Daniel :) ,
Tested the following code and it worked fine :P

Code: Select all

loMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT loMsg
	:Configuration := loCfg
	:From          := Main.cFrom.Value
	:To            := Main.cTo.Value
	:Subject       := "e-Mail test using <<< CDOSYS (Collaboration Data Objects) >>>"
	:TextBody      := Main.Contenido.Value
	For k:=1 to Main.archivos.ItemCount
		:AddAttachment(Main.archivos.Item(k))
	Next k
	:Send()
ENDWITH
Thanks again for your help :D

[]´s Salamandra