• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

Why CDO don´t send email? I got Win2000, IIS 5 with ASP

Hi experts!

I try and try and try...I looking for an error in my ASP code but I don´t send email. I found the CDO dll, and I see in my IIS manger that SMNT exist.

What problem I have?

Thnx a lot
0
javiermorquecho
Asked:
javiermorquecho
  • 2
  • 2
1 Solution
 
BrandonGalderisiCommented:
Can you post your code?
0
 
javiermorquechoAuthor Commented:
Excuse me. The code is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Gracias</title>
</head>
<body>
<%
    Dim destinatario
    Dim nombre
    Dim asunto
    Dim email
    Dim telefono
    Dim direccion
    Dim cp
    Dim localidad        
    Dim estado
    Dim comentario        
 
    destinatario    = Request.Form("destinatario")
    nombre          = Request.Form("nombre")    
    asunto          = Request.Form("asunto")
    email           = Request.Form("email")    
    telefono        = Request.Form("telefono")
    direccion       = Request.Form("direccion")    
    cp              = Request.Form("cp")
    localidad       = Request.Form("localidad")    
    estado          = Request.Form("estado")    
    comentario      = Request.Form("comentario")    
    Set myMail      = CreateObject("CDO.Message")
    If destinatario = "" Then
        myMail.From     = "emailFrom@domain.com"
        myMail.To       = "emailTo@domain.com"
        myMail.HTMLBody = "Mesagge.............shalalalala"
        myMail.Send
        set myMail      = nothing
    Else
        Response.Write( "Error" )
    End If
%>
<!-- Confirmación de envío 
<div style='text-align: center;'><img style='width: 663px; height: 84px;' alt='logo de CTI' src='../Images/logo12.png'><br>
<br>
<br>
    <span style='font-family: Arial'>
Hemos recibido su petici&oacute;n, a la brevedad nos pondremos en contacto con Ud.<br>
<br>
Gracias.</span></div>-->
 
</body>
</html>

Open in new window

0
 
javiermorquechoAuthor Commented:
For testing destinatario = "" is true....
0
 
BrandonGalderisiCommented:
You aren't configuring mymail.

Here's the function that I use.

Public Function sendEmail (emailTo, emailFrom, emailSubject, emailBody)
sendEmail=false
Const cdoSendUsingPickup = 1  'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2    'Send the message using the network (SMTP over the network).
 
Const cdoAnonymous = 0        'Do not authenticate
Const cdoBasic = 1            'basic (clear-text) authentication
Const cdoNTLM = 2             'NTLM
 
const smtpSendUsing = 1       '1=local, 2=remote
Const smtpServer    = "SMTP SERVER"
Const smtpPort      = 25
Const smtpUN        = "SMTP USER NAME"
Const smtpPW        = "SMTP PASSWORD"
Const UseSSL        = False
Const smtpTimeout   = 10
 
Dim email
Set email = server.CreateObject("CDO.Message")
 
With email.Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")               = smtpSendUsing
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")              = smtpserver
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")          = smtpport
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")        = cdoBasic
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername")            = smtpUN
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")            = smtpPW
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl")              = UseSSL
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")   = smtpTimeout
.Update
End With
 
With email
.Subject  = emailSubject
.From     = emailFrom
.To       = emailTo
.TextBody = emailBody
.send
if err=0 then sendEmail=true
End With
 
Set email=Nothing
End function

Open in new window

0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now