Why I have asp name redefined?

Posted on 2009-02-16
Last Modified: 2012-05-06
hi Experts!

I looking for the error in this code, but I don´t find the error. The error is:

Error Type:
Microsoft VBScript compilation (0x800A0411)
Name redefined
webContact/sendEmail.asp, line 29, col 16
Public Function sendEmail(emailTo, emailFrom, emailSubject, emailBody)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >






    Dim sendEmail

    Dim destinatario

    Dim nombre

    Dim asunto

    Dim email

    Dim telefono

    Dim direccion

    Dim cp

    Dim localidad        

    Dim estado

    Dim comentario        

    Dim textBody

    'Dim destinatarios(7)

    Dim destinatarios(8)


    'Realiza el envío del correo electrónico

    'emailTo      Destinatario, email

    'emailFrom    Emisor, email

    'emailSubject Asunto, email

    'emailBody    Mensaje, email

    'Sets sendEmail variable

    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         = ""

        Const smtpPort           = 25

        Const smtpUN             = "jmorquecho"

        Const smtpPW             = "cti011107"

        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

            .Subjec   = emailSubject

            .From     = emailFrom

            .To       = emailTo

            .TextBody = emailBody


            if err=0 then sendEmail=true

        End With 

        Set email=Nothing

    End Function


    'Verifica que el captcha allá sido introducido correctamente

    '@params valCAPTCHA Valor del captcha establecido previamente

    '@Sets CheckCAPTCHA variable

    Function CheckCAPTCHA(valCAPTCHA)

	    SessionCAPTCHA = Trim(Session("CAPTCHA"))

	    Session("CAPTCHA") = vbNullString

	    If Len(SessionCAPTCHA) < 1 then

            CheckCAPTCHA = False

            exit function

        End If

	    If CStr(SessionCAPTCHA) = CStr(valCAPTCHA) then

	        CheckCAPTCHA = True


	        CheckCAPTCHA = False

	    End If

    End Function


	strCAPTCHA = Trim(Request.Form("strCAPTCHA"))

	If CheckCAPTCHA(strCAPTCHA) = True Then

        destinatarios(1) = ""

        destinatarios(2) = ""

        destinatarios(3) = ""

        destinatarios(4) = ""

        destinatarios(5) = ""

        destinatarios(6) = ""

        destinatarios(7) = ""

        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")

        textBody         = "Persona emisora:"            & "/n/n" & _

                            "Nombre: "      & nombre     & "/n"   & _

                            "Asunto: "      & asunto     & "/n"   & _

                            "Email: "       & email      & "/n"   & _

                            "Teléfono : "   & telefono   & "/n"   & _

                            "Dirección : "  & direccion  & "/n"   & _

                            "CP : "         & cp         & "/n"   & _

                            "Localidad : "  & localidad  & "/n"   & _

                            "Estado : "     & estado     & "/n"   & _

                            "Comentario : "              & "/n/n" & comentario

        emailDestino     = destinatarios(destinatario)

        sendEmail emailDestino, "", "mensaje de usuarios en página web", textBody

        If !sendEmail Then

            msg = "No se puedo enviar el email. Por favor, intente más tarde."

            Response.Write("<" & "script language=VBScript>")

            Response.Write("MsgBox """ & msg & """<" & "/script>")



            <!-- 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>




        End If

    End If




Open in new window

Question by:javiermorquecho
    LVL 95

    Accepted Solution

    Hello javiermorquecho,

    Don't use Dim sendEmail as the first ASP line.  You don't need to dimension a function.



    Author Closing Comment

    OK Thnx a lot!!!!!!
    LVL 8

    Expert Comment

    This error means that you have attempted declared a variable (eg dim sendEmail) twice.

    Author Comment

    Yes Wikkard!

    Ufortunatelly, I haven´t point to you....

    Thnx anyway!
    LVL 8

    Expert Comment


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    This video discusses moving either the default database or any database to a new volume.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    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

    24 Experts available now in Live!

    Get 1:1 Help Now