Ver Mensaje Individual
  #110 (permalink)  
Antiguo 04/11/2008, 12:11
Avatar de Muzztein
Muzztein
 
Fecha de Ingreso: agosto-2002
Ubicación: Hangar 18
Mensajes: 1.703
Antigüedad: 21 años, 8 meses
Puntos: 16
Respuesta: Biblioteca de Clases,Funciones y Sub-rutinas.

Funcion para envio de correo electronico.
lo he probado en IIS 5 y funciona siempre

Código asp:
Ver original
  1. function enviaEmail(para,cc,desde,asunto,mensaje,servidor)
  2.     on error resume next
  3.  
  4.     enviaEmail = false
  5.    
  6.     dim objCDO,objCDOConfig,objFields
  7.     Set objCDO      = CreateObject("CDO.Message")
  8.     Set objCDOConfig  = CreateObject("CDO.Configuration")
  9.     Set objFields    = objCDOConfig.Fields
  10.        
  11.     With objFields
  12.       .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = servidor
  13.       .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  14.       .Item("http://schemas.microsoft.com/cdo/configuration/SendUsing") = 2
  15.       .Update
  16.     End With
  17.    
  18.     With objCDO
  19.       .Configuration  = objCDOConfig
  20.       .To          = para
  21.    
  22.     if cc <> false then
  23.       .cc          = cc
  24.     end if  
  25.    
  26.       .From        = desde
  27.       .Subject     = asunto
  28.       .TextBody    = mensaje
  29.       .Send
  30.     End With
  31.    
  32.     Set objFields = Nothing
  33.     Set objCDO = Nothing
  34.     Set objCDOConfig = Nothing
  35.    
  36.     if err.number = 0 then
  37.         enviaEmail = true
  38.     else
  39.         enviaEmail = err.description
  40.     end if
  41.     on error goto 0
  42.  
  43. end function