Generate email when I click button?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • McKirahan

    #31
    Re: Generate email when I click button?

    "majahops via WebmasterKB.com " <u37541@uwewrot e in message
    news:79ced47655 496@uwe...
    .. but i put a space between ) and "then" of course
    >
    majahops wrote:
    So when I put in the code, I get the following message when I try to save
    the
    record:

    Error number 3749
    Error description Fields update failed. For further information, examine
    the
    Status property of individual field objects.

    ...

    Here is my code (i renamed the function to "mail")

    function mail
    If mail(email,"you r subject","your message")then
    ' success
    Else
    ' failure
    End If
    end function
    [snip]

    You're calling the function from within itself!

    Why did you put the "If" statement inside of a function?

    Look another look at what I gave you before.


    Comment

    • McKirahan

      #32
      Re: Generate email when I click button?

      "McKirahan" <News@McKirahan .comwrote in message
      news:ZOednS4At8 ggnYvanZ2dnUVZ_ sSlnZ2d@comcast .com...
      "majahops via WebmasterKB.com " <u37541@uwewrot e in message
      news:79ced47655 496@uwe...
      .. but i put a space between ) and "then" of course

      majahops wrote:
      >So when I put in the code, I get the following message when I try to
      save
      the
      >record:
      >
      >Error number 3749
      >Error description Fields update failed. For further information,
      examine
      the
      >Status property of individual field objects.
      >
      >...
      >
      >Here is my code (i renamed the function to "mail")
      >
      >function mail
      >If mail(email,"you r subject","your message")then
      >' success
      >Else
      >' failure
      >End If
      >end function
      >
      [snip]
      >
      You're calling the function from within itself!
      >
      Why did you put the "If" statement inside of a function?
      >
      Look another look at what I gave you before.
      Take another look at what I gave you before.

      Use the function that worked for you before:

      Function Email(sAddr,sSu bj,sBody)
      ...
      End Function


      Comment

      • majahops via WebmasterKB.com

        #33
        Re: Generate email when I click button?

        Oh no, I meant that was the code for CALLING the function.

        McKirahan wrote:
        .. but i put a space between ) and "then" of course
        >
        >[quoted text clipped - 26 lines]
        >>
        >Look another look at what I gave you before.
        >
        >Take another look at what I gave you before.
        >
        >Use the function that worked for you before:
        >
        Function Email(sAddr,sSu bj,sBody)
        ...
        End Function
        --
        Message posted via WebmasterKB.com


        Comment

        • majahops via WebmasterKB.com

          #34
          Re: Generate email when I click button?

          I'm looking at this and I am so lost. Right now I have a file called
          Doctors_add.asp , which works well to add a doctors record. The part of this
          file with the function in it is below:

          Response.Write( "send_email = " & send_email("maj ahops@gemail.co m","Test",
          "Test!"))

          Function send_email(sAdd r,sSubj,sBody)
          send_email = False
          On Error Resume Next
          '*
          '* Declare Constants
          '*
          Const cCDO = "http://schemas.microso ft.com/cdo/configuration/"
          Const cHST = "relay-hosting.secures erver.net"
          Const cFRM = "tbeer@mednet.u cla.edu"
          '*
          '* Send email
          '*
          Dim objCFG
          Set objCFG = Server.CreateOb ject("CDO.Confi guration")
          objCFG.Fields.I tem(cCDO & "sendusing" ) = 2
          objCFG.Fields.I tem(cCDO & "smtpserver ") = cHST
          objCFG.Fields.I tem(cCDO & "smtpserverport ") = 25
          objCFG.Fields.U pdate
          Dim objCDO
          Set objCDO = Server.CreateOb ject("CDO.Messa ge")
          objCDO.From = cFRM
          objCDO.To = sAddr
          'objCDO.BCC = ""
          'objCDO.CC = ""
          objCDO.Subject = sSubj
          objCDO.TextBody = sBody
          'objCDO.HTMLBod y = sBody
          'objCDO.AddAtta chment = ""
          objCDO.Configur ation = objCFG
          objCDO.Send
          ' If Err = 0 Then
          ' Response.Write( "<br><br><b >E-email has been sent.</b>")
          ' Else
          ' Response.Write( "<br><b>Sub send_email()</b>")
          ' Response.Write( "<br><b>CDO Failed:</b" & Err.Description )
          ' Response.Write( "<br><b>CDO 'Addr':</b" & sAddr)
          ' Response.Write( "<br><b>CDO 'Subj':</b" & sSubj)
          ' Response.Write( "<br><b>CDO 'Body':</b" & sBody)
          ' End If
          Set objCDO = Nothing
          Set objCFG = Nothing
          '*
          '* Return
          '*
          On Error GoTo 0
          send_email = True
          End Function

          ... but no email is sent when I click save. Any idea?

          --
          Message posted via http://www.webmasterkb.com

          Comment

          • McKirahan

            #35
            Re: Generate email when I click button?

            "majahops via WebmasterKB.com " <u37541@uwewrot e in message
            news:79d5bea87d 8b4@uwe...
            I'm looking at this and I am so lost. Right now I have a file called
            Doctors_add.asp , which works well to add a doctors record. The part of
            this
            file with the function in it is below:
            >
            Response.Write( "send_email = " & send_email("maj ahops@gemail.co m","Test",
            "Test!"))
            What does the above line return?

            Is it "send_mail = True" or send_mail = False"?

            Remove the single quotes from theses lines and see what you get.

            ' If Err = 0 Then
            ' Response.Write( "<br><br><b >E-email has been sent.</b>")
            ' Else
            ' Response.Write( "<br><b>Sub send_email()</b>")
            ' Response.Write( "<br><b>CDO Failed:</b" & Err.Description )
            ' Response.Write( "<br><b>CDO 'Addr':</b" & sAddr)
            ' Response.Write( "<br><b>CDO 'Subj':</b" & sSubj)
            ' Response.Write( "<br><b>CDO 'Body':</b" & sBody)
            ' End If



            Comment

            Working...