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

Posted on 2009-02-13
Last Modified: 2013-12-05
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
Question by:javiermorquecho
    LVL 39

    Expert Comment

    Can you post your code?

    Author Comment

    Excuse me. The code is:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="" >
        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     = ""
            myMail.To       = ""
            myMail.HTMLBody = "Mesagge.............shalalalala"
            set myMail      = nothing
            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>
        <span style='font-family: Arial'>
    Hemos recibido su petici&oacute;n, a la brevedad nos pondremos en contacto con Ud.<br>

    Open in new window


    Author Comment

    For testing destinatario = "" is true....
    LVL 39

    Accepted Solution

    You aren't configuring mymail.

    Here's the function that I use.
    Public Function sendEmail (emailTo, emailFrom, emailSubject, emailBody)
    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("")               = smtpSendUsing
    .Item("")              = smtpserver
    .Item("")          = smtpport
    .Item("")        = cdoBasic
    .Item("")            = smtpUN
    .Item("")            = smtpPW
    .Item("")              = UseSSL
    .Item("")   = smtpTimeout
    End With
    With email
    .Subject  = emailSubject
    .From     = emailFrom
    .To       = emailTo
    .TextBody = emailBody
    if err=0 then sendEmail=true
    End With
    Set email=Nothing
    End function

    Open in new window


    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now