Example Using CDO to Send Mail

Started by lucindom, February 14, 2007, 07:34:42 PM

Previous topic - Next topic

lucindom

please, some sample over CDO in PellesC.

An Example in Visual Basic:
   Dim iMsg As Object
   Dim iConf As Object
On Error GoTo salir1
   Set iMsg = CreateObject("CDO.Message")
   Set iConf = CreateObject("CDO.Configuration")
   iConf.Load -1    ' CDO Source Defaults
   With iConf.Fields
      .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.cantv.net"
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      .Item("http://schemas.microsoft.com/cdo/configuration/SMTPAuthenticate") = 0
      .Item("http://schemas.microsoft.com/cdo/configuration/SendUserName") = "direccion@cantv.net"
      .Item("http://schemas.microsoft.com/cdo/configuration/SendPassword") = ""
      .Update
   End With

   
   With iMsg
       Set .Configuration = iConf
       .To = "persona1@hotmail.com;persona2@hotmail.com"
       .CC = ""
       .BCC = ""
       .From = "persona@cantv.net"
       .Subject = "Correo enviado para prueba de CDO"
       .TextBody = "Saludos cordiales"
       .AddAttachment "c:\reporte.xls"
       .Send
   End With
salir1:
   Set iMsg = Nothing
   Set iConf = Nothing