Generate email when I click button?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • majahops via WebmasterKB.com

    Generate email when I click button?

    When I click "save" after adding a new record (which contains, among other
    fields, the person's email address), I want an email to automatically be sent
    to that person (at the email that is in the field of that record). How can I
    do this?

    Thanks so much, it really means so much to me!!!

    --
    Message posted via WebmasterKB.com


  • McKirahan

    #2
    Re: Generate email when I click button?

    "majahops via WebmasterKB.com " <u37541@uwewrot e in message
    news:798bc3f05f 9b3@uwe...
    When I click "save" after adding a new record (which contains, among other
    fields, the person's email address), I want an email to automatically be
    sent
    to that person (at the email that is in the field of that record). How can
    I
    do this?
    What does your Web host support?
    Perhaps, CDO.Message or ASPMail.



    Comment

    • majahops via WebmasterKB.com

      #3
      Re: Generate email when I click button?

      First off, thank you SO much for responding - it mean's a lot to me - i've
      been trying to get this done forever.

      So I have godaddy.com. When I look up what they support, I get the following:


      CDO.MESSAGE
      CDONTS.NewMail

      I'm assuming that means that godaddy.com supports CDO.Message.

      Thank you so so so so so much again. My heart skipped a beat when I saw that
      somebody had finally [at least tried] to answer my cries for help.

      Tim


      McKirahan wrote:
      >When I click "save" after adding a new record (which contains, among other
      >fields, the person's email address), I want an email to automatically be sent
      >to that person (at the email that is in the field of that record). How can I
      >do this?
      >
      >What does your Web host support?
      >Perhaps, CDO.Message or ASPMail.
      --
      Message posted via WebmasterKB.com


      Comment

      • McKirahan

        #4
        Re: Generate email when I click button?

        "majahops via WebmasterKB.com " <u37541@uwewrot e in message
        news:798cc27bb4 82e@uwe...
        First off, thank you SO much for responding - it mean's a lot to me - i've
        been trying to get this done forever.
        >
        So I have godaddy.com. When I look up what they support, I get the
        following:
        >
        >
        CDO.MESSAGE
        CDONTS.NewMail
        >
        I'm assuming that means that godaddy.com supports CDO.Message.
        [snip]

        Try this; watch for word-wrap.

        The Response.Write( ) statement invokes the function;
        modify it to suit your needs. Just call the function by
        passing in 3 parms: email address, subject, and body.

        The value of "cHST" (Host) is what GoDaddy requires.
        The value of "cFRM" (From) is your email address.

        Suucess/failure reporting has been commented out as
        you may want to log the results rather than display them.

        <%@ Language="VBScr ipt" %>
        <% Option Explicit

        Response.Write( "Email = " & Email("news@mck irahan.com","Te st","Test!"))

        Function Email(sAddr,sSu bj,sBody)
        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 = "postmaster@{yo ur~domain.com}"
        '*
        '* 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-mail has been sent.</b>")
        ' Else
        ' Response.Write( "<br><b>Sub 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
        Email = True
        End Function
        %>


        Comment

        • majahops via WebmasterKB.com

          #5
          Re: Generate email when I click button?

          McKirahan,

          Before I do this, where do I put all of this text? That has been one of the
          things that is unclear to me. Do I put it next to the like where the save-
          button is in the html, or what? Thanks so much again!

          McKirahan wrote:
          >First off, thank you SO much for responding - it mean's a lot to me - i've
          >been trying to get this done forever.
          >[quoted text clipped - 5 lines]
          >>
          >I'm assuming that means that godaddy.com supports CDO.Message.
          >
          >[snip]
          >
          >Try this; watch for word-wrap.
          >
          >The Response.Write( ) statement invokes the function;
          >modify it to suit your needs. Just call the function by
          >passing in 3 parms: email address, subject, and body.
          >
          >The value of "cHST" (Host) is what GoDaddy requires.
          >The value of "cFRM" (From) is your email address.
          >
          >Suucess/failure reporting has been commented out as
          >you may want to log the results rather than display them.
          >
          ><%@ Language="VBScr ipt" %>
          ><% Option Explicit
          >
          >Response.Write ("Email = " & Email("news@mck irahan.com","Te st","Test!"))
          >
          >Function Email(sAddr,sSu bj,sBody)
          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 = "postmaster@{yo ur~domain.com}"
          '*
          '* 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-mail has been sent.</b>")
          >' Else
          >' Response.Write( "<br><b>Sub 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
          Email = True
          >End Function
          >%>
          --
          Message posted via WebmasterKB.com


          Comment

          • majahops via WebmasterKB.com

            #6
            Re: Generate email when I click button?

            Here is the area of html around the save button (plus some more)...where
            would i put the part you gave me into this? Thanks so much again!!!

            <TD class=shade style="BACKGROU ND-COLOR: #e6e6fa" width=172>
            <P align=right>SPI D</P></TD>
            <TD width=240>{buil d_edit_control field="SPID" mode="add" value=
            $value_SPID} </TD></TR>
            <TR height=50>
            <TD style="BACKGROU ND-COLOR: #e6e6fa" align=middle width=414
            colSpan=2><INPU T class=button id=submit1 type=submit value=Save name=submit1>

            <INPUT class=button type=reset value=Reset<inp ut type=hidden name="a"
            value="added"></TD></TR></FORM><!-- legend -->
            <TR height=50>
            <TD style="BACKGROU ND-COLOR: #e6e6fa" align=left width=414 colSpan=2>
            <HR width=400 noShade SIZE=1>
            <BR><IMG src="images/icon_required.g if"- Required field
            </TD></TR></TBODY></TABLE>{include_ if_exists file="include/footer.asp"} {
            $linkdata}<scri pt>SetToFirstCo ntrol();</script></BODY></HTML>


            McKirahan wrote:
            >First off, thank you SO much for responding - it mean's a lot to me - i've
            >been trying to get this done forever.
            >[quoted text clipped - 5 lines]
            >>
            >I'm assuming that means that godaddy.com supports CDO.Message.
            >
            >[snip]
            >
            >Try this; watch for word-wrap.
            >
            >The Response.Write( ) statement invokes the function;
            >modify it to suit your needs. Just call the function by
            >passing in 3 parms: email address, subject, and body.
            >
            >The value of "cHST" (Host) is what GoDaddy requires.
            >The value of "cFRM" (From) is your email address.
            >
            >Suucess/failure reporting has been commented out as
            >you may want to log the results rather than display them.
            >
            ><%@ Language="VBScr ipt" %>
            ><% Option Explicit
            >
            >Response.Write ("Email = " & Email("news@mck irahan.com","Te st","Test!"))
            >
            >Function Email(sAddr,sSu bj,sBody)
            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 = "postmaster@{yo ur~domain.com}"
            '*
            '* 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-mail has been sent.</b>")
            >' Else
            >' Response.Write( "<br><b>Sub 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
            Email = True
            >End Function
            >%>
            --
            Message posted via WebmasterKB.com


            Comment

            • McKirahan

              #7
              Re: Generate email when I click button?

              "majahops via WebmasterKB.com " <u37541@uwewrot e in message
              news:798d6cf71f 578@uwe...
              Here is the area of html around the save button (plus some more)...where
              would i put the part you gave me into this? Thanks so much again!!!
              >
              <TD class=shade style="BACKGROU ND-COLOR: #e6e6fa" width=172>
              <P align=right>SPI D</P></TD>
              <TD width=240>{buil d_edit_control field="SPID" mode="add" value=
              $value_SPID} </TD></TR>
              <TR height=50>
              <TD style="BACKGROU ND-COLOR: #e6e6fa" align=middle width=414
              colSpan=2><INPU T class=button id=submit1 type=submit value=Save
              name=submit1>
              >
              <INPUT class=button type=reset value=Reset<inp ut type=hidden name="a"
              value="added"></TD></TR></FORM><!-- legend -->
              <TR height=50>
              <TD style="BACKGROU ND-COLOR: #e6e6fa" align=left width=414 colSpan=2>
              <HR width=400 noShade SIZE=1>
              <BR><IMG src="images/icon_required.g if"- Required field
              </TD></TR></TBODY></TABLE>{include_ if_exists file="include/footer.asp"} {
              $linkdata}<scri pt>SetToFirstCo ntrol();</script></BODY></HTML>
              Where's your ASP code?


              Comment

              • McKirahan

                #8
                Re: Generate email when I click button?

                "majahops via WebmasterKB.com " <u37541@uwewrot e in message
                news:798d65d083 2f8@uwe...
                McKirahan,
                >
                Before I do this, where do I put all of this text? That has been one of
                the
                things that is unclear to me. Do I put it next to the like where the save-
                button is in the html, or what? Thanks so much again!
                [snip]

                You're original post included the following statement:
                >When I click "save" after adding a new record ...
                What is the ASP logic behind your save button.

                After the "save" call the "Email()" function.
                You do know something about ASP don't you?
                All ASP code is between <% and %tags unless it's "included".


                Comment

                • McKirahan

                  #9
                  Re: Generate email when I click button?

                  "majahops via WebmasterKB.com " <u37541@uwewrot e in message
                  news:798f55780a fd8@uwe...
                  Sorry about that, here is the asp for that "Add doctor" page: Thank you
                  again!

                  [snip 2400+ lines!]
                  McKirahan wrote:
                  Here is the area of html around the save button (plus some
                  more)...where
                  would i put the part you gave me into this? Thanks so much again!!!
                  Where's your ASP code?
                  Insert the Function Email() after your ASP code but within <% and %>.

                  After you save the Doctor then call the "Email()" function as I
                  showed you in the Response.Write( ) statement; for example:

                  If Email("news@mck irahan.com","Te st","Test!")) Then
                  ' success
                  Else
                  ' failure
                  End If

                  How do you save the Doctor?
                  I don't see any database code.
                  What database are you using?
                  Is the code within an "include"?


                  Comment

                  • majahops via WebmasterKB.com

                    #10
                    Re: Generate email when I click button?

                    Is this what you mean? Thanks so much by the way.

                    <TD class=shade style="BACKGROU ND-COLOR: #e6e6fa" width=172>
                    <P align=right>SPI D</P></TD>

                    <TD width=240>{buil d_edit_control field="SPID" mode="add" value=
                    $value_SPID} </TD></TR>
                    <TR height=50>
                    <TD style="BACKGROU ND-COLOR: #e6e6fa" align=middle width=414
                    colSpan=2><INPU T class=button id=submit1 type=submit value=Save name=submit1>

                    <INPUT class=button type=reset value=Reset<inp ut type=hidden name="a"
                    value="added"></TD></TR></FORM><!-- legend -->
                    <TR height=50>
                    <TD style="BACKGROU ND-COLOR: #e6e6fa" align=left width=414 colSpan=2>
                    <HR width=400 noShade SIZE=1>
                    <BR><IMG src="images/icon_required.g if"- Required field

                    </TD></TR></TBODY></TABLE>{include_ if_exists file="include/footer.asp"} {
                    $linkdata}<scri pt>SetToFirstCo ntrol();</script></BODY></HTML>


                    McKirahan wrote:
                    >Sorry about that, here is the asp for that "Add doctor" page: Thank you again!
                    >
                    >[snip 2400+ lines!]
                    >
                    >Here is the area of html around the save button (plus some more)...where
                    >would i put the part you gave me into this? Thanks so much again!!!
                    >
                    >Where's your ASP code?
                    >
                    >Insert the Function Email() after your ASP code but within <% and %>.
                    >
                    >After you save the Doctor then call the "Email()" function as I
                    >showed you in the Response.Write( ) statement; for example:
                    >
                    >If Email("news@mck irahan.com","Te st","Test!")) Then
                    >' success
                    >Else
                    >' failure
                    >End If
                    >
                    >How do you save the Doctor?
                    >I don't see any database code.
                    >What database are you using?
                    >Is the code within an "include"?
                    --
                    Message posted via WebmasterKB.com


                    Comment

                    • majahops via WebmasterKB.com

                      #11
                      Re: Generate email when I click button?

                      McKirahan, would it be possible to email you directly?

                      McKirahan wrote:
                      >Sorry about that, here is the asp for that "Add doctor" page: Thank you again!
                      >
                      >[snip 2400+ lines!]
                      >
                      >Here is the area of html around the save button (plus some more)...where
                      >would i put the part you gave me into this? Thanks so much again!!!
                      >
                      >Where's your ASP code?
                      >
                      >Insert the Function Email() after your ASP code but within <% and %>.
                      >
                      >After you save the Doctor then call the "Email()" function as I
                      >showed you in the Response.Write( ) statement; for example:
                      >
                      >If Email("news@mck irahan.com","Te st","Test!")) Then
                      >' success
                      >Else
                      >' failure
                      >End If
                      >
                      >How do you save the Doctor?
                      >I don't see any database code.
                      >What database are you using?
                      >Is the code within an "include"?
                      --
                      Message posted via WebmasterKB.com


                      Comment

                      • McKirahan

                        #12
                        Re: Generate email when I click button?


                        "majahops via WebmasterKB.com " <u37541@uwewrot e in message
                        news:799624a471 8c6@uwe...
                        Is this what you mean? Thanks so much by the way.
                        [snip]

                        No.


                        Comment

                        • McKirahan

                          #13
                          Re: Generate email when I click button?

                          "majahops via WebmasterKB.com " <u37541@uwewrot e in message
                          news:7997f7b5ea 12a@uwe...
                          McKirahan, would it be possible to email you directly?
                          [snip]

                          Let's keep it in the newsgroup so others may benefit.


                          Comment

                          • majahops via WebmasterKB.com

                            #14
                            Re: Generate email when I click button?

                            Thanks for trying to help, but it doesn't seem like anybody knows how to do
                            this when it comes down to it. I do sincerely appreciate your help though.

                            Tim

                            McKirahan wrote:
                            >McKirahan, would it be possible to email you directly?
                            >
                            >[snip]
                            >
                            >Let's keep it in the newsgroup so others may benefit.
                            --
                            Message posted via WebmasterKB.com


                            Comment

                            • majahops via WebmasterKB.com

                              #15
                              Re: Generate email when I click button?

                              And what do you mean by "snip"?

                              majahops wrote:
                              >Thanks for trying to help, but it doesn't seem like anybody knows how to do
                              >this when it comes down to it. I do sincerely appreciate your help though.
                              >
                              >Tim
                              >
                              >>McKirahan, would it be possible to email you directly?
                              >>
                              >>[snip]
                              >>
                              >>Let's keep it in the newsgroup so others may benefit.
                              --
                              Message posted via WebmasterKB.com


                              Comment

                              Working...