|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
CDO.Message sent whenever page loads, though the form not submitte
But a (blank) e-mail is sent whenever the page loads, even when the form is not submitted. I would like to receive the e-mail only when the form is submitted <%@LANGUAGE="VBSCRIPT"%> <% Set MyMail=CreateObject("CDO.Message") MyMail.TextBody=Request.Form("name") & vbCrLf & _ Request.Form("email")& vbCrLf & _ Request.Form("phone")& vbCrLf & _ Request.Form("palaver") MyMail.From=" rate***@yahoo.com" MyMail.To="a***@gmail.com" MyMail.Cc="" MyMail.Bcc="" MyMail.Subject="cosas de cuero" MyMail.Send() Set MyMail=Nothing %> Part two: The script below could be part of the problem. It is in the html body below the closing form tag </form> and works when the form is submitted, but I would prefer not to use it, but instead to have a redirect to a confirmation page. But if I use "response.redirect", the page with the form never opens. Only the confirmation page opens. So I have two questions, and am obviously a novice. This forum has been a lifesaver in the past Thanks Alan Lipman alegrate***@yahoo.com calipasof***@hotmail.com <% dim email email=Request.Form("email") If email<>"" Then Response.Write("Hello " & email & "!<br />") Response.Write("We have receved your submission") End If %> There are a number of ways to check to see if the form has been posted. One
is Request.ServerVariables("REQUEST_METHOD") If Request.ServerVariables("REQUEST_METHOD") = "POST" Then '''your code for e-mailing End If As for part 2, put the Response.Redirect in that IF block as well after the code that sends the e-mail. <% If Request.ServerVariables("REQUEST_METHOD") = "POST" Then ''code for e-mail Response.Redirect "confirmed.asp" End If %> <form..... Ray at work Show quote "whyyyy" <why***@discussions.microsoft.com> wrote in message news:C6231351-D170-4E30-9F7A-6AD43D51415B@microsoft.com... > The script below works fine if the form is filled out and submitted. > > But a (blank) e-mail is sent whenever the page loads, even when the form > is > not submitted. I would like to receive the e-mail only when the form is > submitted > Part two: The script below could be part of the problem. It is in the html > body below the closing form tag </form> and works when the form is > submitted, > but I would prefer not to use it, but instead to have a redirect to a > confirmation page. > > But if I use "response.redirect", the page with the form never opens. Only > the confirmation page opens. > > So I have two questions, and am obviously a novice. > > This forum has been a lifesaver in the past > > Thanks > > Alan Lipman > alegrate***@yahoo.com > calipasof***@hotmail.com > > <% > dim email > email=Request.Form("email") > If email<>"" Then > Response.Write("Hello " & email & "!<br />") > Response.Write("We have receved your submission") > End If > %> Hello Ray
Thanks I'm not sure if you anserwed the first question, which is how to prevent a bank e-mail from being sent every time the page is opened, whether or not the form is submitted. Thanks for the help with response.redirect, the second question Sincerely Alan Show quote "Ray Costanzo [MVP]" wrote: > There are a number of ways to check to see if the form has been posted. One > is Request.ServerVariables("REQUEST_METHOD") > > If Request.ServerVariables("REQUEST_METHOD") = "POST" Then > '''your code for e-mailing > End If > > > As for part 2, put the Response.Redirect in that IF block as well after the > code that sends the e-mail. > > > <% > > If Request.ServerVariables("REQUEST_METHOD") = "POST" Then > ''code for e-mail > Response.Redirect "confirmed.asp" > End If > %> > > <form..... > > > Ray at work > > > "whyyyy" <why***@discussions.microsoft.com> wrote in message > news:C6231351-D170-4E30-9F7A-6AD43D51415B@microsoft.com... > > The script below works fine if the form is filled out and submitted. > > > > But a (blank) e-mail is sent whenever the page loads, even when the form > > is > > not submitted. I would like to receive the e-mail only when the form is > > submitted > > > > Part two: The script below could be part of the problem. It is in the html > > body below the closing form tag </form> and works when the form is > > submitted, > > but I would prefer not to use it, but instead to have a redirect to a > > confirmation page. > > > > But if I use "response.redirect", the page with the form never opens. Only > > the confirmation page opens. > > > > So I have two questions, and am obviously a novice. > > > > This forum has been a lifesaver in the past > > > > Thanks > > > > Alan Lipman > > alegrate***@yahoo.com > > calipasof***@hotmail.com > > > > <% > > dim email > > email=Request.Form("email") > > If email<>"" Then > > Response.Write("Hello " & email & "!<br />") > > Response.Write("We have receved your submission") > > End If > > %> > > > > I'm not sure if you anserwed the first question, which is how to prevent a Did you see the "if / end if" parts of his response? That pretty much > bank e-mail from being sent every time the page is opened, whether or not > the > form is submitted. answered the question. Thank you Aaron
Unfortunately, I`m still in the dark I sent another reply to Ray, Thanks again AL Show quote "Aaron Bertrand [SQL Server MVP]" wrote: > > I'm not sure if you anserwed the first question, which is how to prevent a > > bank e-mail from being sent every time the page is opened, whether or not > > the > > form is submitted. > > Did you see the "if / end if" parts of his response? That pretty much > answered the question. > > > I tried to reply earlier but something went wrong. Unfortunately I don`t know
what the following terms mean, exactly, or even inexactly. '''your code for e-mailing ''code for e-mail But I tried various things and couldn`t get the page open at all until I put this: <%@LANGUAGE="VBSCRIPT"%> <% If Request.ServerVariables("REQUEST_METHOD") = "POST" Then Set MyMail=CreateObject("CDO.Message") Response.Redirect "confirmed.asp" MyMail.TextBody=Request.Form("name") & vbCrLf & _ Request.Form("email")& vbCrLf & _ Request.Form("phone")& vbCrLf & _ Request.Form("palaver") MyMail.From="a***@gmail.com" MyMail.To="a***@gmail.com" MyMail.Cc="alegrate***@yahoo.com" MyMail.Bcc="" MyMail.Subject="cosas de cuero" MyMail.Send() Set MyMail=Nothing End If %> This appears to work beautifully. But, sadly, no e-mail is received when the form id submitted. So I need more help, please Thanks AL Show quote "Ray Costanzo [MVP]" wrote: > There are a number of ways to check to see if the form has been posted. One > is Request.ServerVariables("REQUEST_METHOD") > > If Request.ServerVariables("REQUEST_METHOD") = "POST" Then > '''your code for e-mailing > End If > > > As for part 2, put the Response.Redirect in that IF block as well after the > code that sends the e-mail. > > > <% > > If Request.ServerVariables("REQUEST_METHOD") = "POST" Then > ''code for e-mail > Response.Redirect "confirmed.asp" > End If > %> > > <form..... > > > Ray at work > > > "whyyyy" <why***@discussions.microsoft.com> wrote in message > news:C6231351-D170-4E30-9F7A-6AD43D51415B@microsoft.com... > > The script below works fine if the form is filled out and submitted. > > > > But a (blank) e-mail is sent whenever the page loads, even when the form > > is > > not submitted. I would like to receive the e-mail only when the form is > > submitted > > > > Part two: The script below could be part of the problem. It is in the html > > body below the closing form tag </form> and works when the form is > > submitted, > > but I would prefer not to use it, but instead to have a redirect to a > > confirmation page. > > > > But if I use "response.redirect", the page with the form never opens. Only > > the confirmation page opens. > > > > So I have two questions, and am obviously a novice. > > > > This forum has been a lifesaver in the past > > > > Thanks > > > > Alan Lipman > > alegrate***@yahoo.com > > calipasof***@hotmail.com > > > > <% > > dim email > > email=Request.Form("email") > > If email<>"" Then > > Response.Write("Hello " & email & "!<br />") > > Response.Write("We have receved your submission") > > End If > > %> > > > >I tried to reply earlier but something went wrong. Unfortunately I don`t That's the part that starts with Set MyMail = CreateObject("CDO.Message") >know > what the following terms mean, exactly, or even inexactly. > '''your code for e-mailing > ''code for e-mail and ends with Set MyMail = Nothing > If Request.ServerVariables("REQUEST_METHOD") = "POST" Then Why are you doing this here? You haven't set up the message or sent it yet. > Set MyMail=CreateObject("CDO.Message") > Response.Redirect "confirmed.asp" Try moving this Response.Redirect line down to after the End If. A I don`t want to check to see if the form has been posted
I want to stop a blank email from being sent whenever the page with the form is opened. The email has nothing to do with the form. I want e-mail to be sent when the submit button is pressed. It is sent when the submit button is pressed, and the response redirect works fine. The problem is if someone lands on the page an empty email is sent Please help -- this is the general idea: IF submit button pressed THEN send email ELSE do nothing Alan Show quote "Ray Costanzo [MVP]" wrote: > There are a number of ways to check to see if the form has been posted. One > is Request.ServerVariables("REQUEST_METHOD") > > If Request.ServerVariables("REQUEST_METHOD") = "POST" Then > '''your code for e-mailing > End If > > > As for part 2, put the Response.Redirect in that IF block as well after the > code that sends the e-mail. > > > <% > > If Request.ServerVariables("REQUEST_METHOD") = "POST" Then > ''code for e-mail > Response.Redirect "confirmed.asp" > End If > %> > > <form..... > > > Ray at work > > > "whyyyy" <why***@discussions.microsoft.com> wrote in message > news:C6231351-D170-4E30-9F7A-6AD43D51415B@microsoft.com... > > The script below works fine if the form is filled out and submitted. > > > > But a (blank) e-mail is sent whenever the page loads, even when the form > > is > > not submitted. I would like to receive the e-mail only when the form is > > submitted > > > > Part two: The script below could be part of the problem. It is in the html > > body below the closing form tag </form> and works when the form is > > submitted, > > but I would prefer not to use it, but instead to have a redirect to a > > confirmation page. > > > > But if I use "response.redirect", the page with the form never opens. Only > > the confirmation page opens. > > > > So I have two questions, and am obviously a novice. > > > > This forum has been a lifesaver in the past > > > > Thanks > > > > Alan Lipman > > alegrate***@yahoo.com > > calipasof***@hotmail.com > > > > <% > > dim email > > email=Request.Form("email") > > If email<>"" Then > > Response.Write("Hello " & email & "!<br />") > > Response.Write("We have receved your submission") > > End If > > %> > > > > The problem is if someone lands on the page an empty email is sent When someone lands on the page, they did so because they didn't submit the form. This is why you to check to see if the form has been posted. While it may not be what you *want* to do, it's what you do to make it work the way you want the result. > IF You can check if the form was posted using Ray's method.> submit button pressed Or, you can check if any of the *required* fields on your form is not empty. E.g. if Request.Form("email") <> "" then ... ' send mail ' redirect end if If you want onclick handling on the server side, maybe it's time to move to ASP.Net. Because it doesn't seem like ASP works the way you *want* it to. A I would be very happy if you could tell me where to find any form-mail script
that works with windows servers cdont dont work any more CDO.Message dont work either unless I had any idea what you guys are talking about. This worked somewhere, but didn`t work somewhwere else. I guess I'll try it again <% @LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail component. Mail.FromName = "Reservas" Mail.FromAddress= Request.Form("email1") Mail.RemoteHost = "smtp.1and1.com" Mail.AddRecipient "Saboriarte", "soniaser***@yahoo.com" Mail.AddRecipient "Saboriarte", "soniase***@saboriarte.com" Mail.AddRecipient "Saboriarte", "alegrate***@yahoo.com" Mail.Subject = "http://saboriarte.com/forminfo.asp" Mail.BodyText = Request.Form("email1") Mail.BodyText = Request.Form("tarifas") Mail.BodyText = Request.Form("TAcomoda") Mail.BodyText = Request.Form("cama_add") Mail.BodyText = Request.Form("cama_added") Mail.BodyText = Request.Form("persons") Mail.BodyText = Request.Form("NPersonas") Mail.BodyText = Request.Form("nights") Mail.BodyText = Request.Form("NNoches") Mail.BodyText = Request.Form("Dia") Mail.BodyText = Request.Form("Mes") Mail.BodyText = Request.Form("Ano") Mail.BodyText = Request.Form("results") Mail.BodyText = Request.Form("info") %> <HTML> <% if Mail.SendMail then Response.Redirect ( "Gracias.asp") else Response.Write "" end if %> AL Show quote "Aaron Bertrand [SQL Server MVP]" wrote: > > The problem is if someone lands on the page an empty email is sent > > When someone lands on the page, they did so because they didn't submit the > form. This is why you to check to see if the form has been posted. > > While it may not be what you *want* to do, it's what you do to make it work > the way you want the result. > > > IF > > submit button pressed > > You can check if the form was posted using Ray's method. > Or, you can check if any of the *required* fields on your form is not empty. > E.g. > > if Request.Form("email") <> "" then > ... > ' send mail > ' redirect > end if > > If you want onclick handling on the server side, maybe it's time to move to > ASP.Net. Because it doesn't seem like ASP works the way you *want* it to. > > A > > > > cdont dont work any more CDONTS was deprecated because it sucked.> CDO.Message dont work either unless I had any idea what you guys are What does "dont work" mean?> talking > about. Here is a script using CDO.Message. You just have to replace certain elements with values appropriate for your environment: http://www.aspfaq.com/2026 > Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail You have to install this component sold by www.serverobjects.com ... but I > component. don't really recommend it because you don't need it. Again, what is wrong with using CDO.Message? A Thanks again
When I used Request.ServerVariables("REQUEST_METHOD") = "POST", etc, either the page didnt open or every thing appeared to be just fine, but no email was sent ` So I wrote it dont work (not real english, but, slang for it doesn`t work) -- Show quoteBut the truth is: I`m sure that Mr. Jones is correct: "seems that you do not understand" Sincerely AL "Aaron Bertrand [SQL Server MVP]" wrote: > > cdont dont work any more > > CDONTS was deprecated because it sucked. > > > CDO.Message dont work either unless I had any idea what you guys are > > talking > > about. > > What does "dont work" mean? > > Here is a script using CDO.Message. You just have to replace certain > elements with values appropriate for your environment: > http://www.aspfaq.com/2026 > > > Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail > > component. > > You have to install this component sold by www.serverobjects.com ... but I > don't really recommend it because you don't need it. > > Again, what is wrong with using CDO.Message? > > A > > > alan wrote:
> When I used Request.ServerVariables("REQUEST_METHOD") = "POST"... You could just as easily look for content in the Request.Form collection, BTW. > ...either the page didnt open or every thing appeared to be just Do you know how to read an ASP error message? If you actually reached a line > fine, but no email was sent in which you called the Send() method of a CDO.Message object, but got no error message, then the message was sent. For some reason, I am already assuming that you have SMTP services running, or have correctly figured out how to send via remote SMTP server. That is probably an error on my part. But assuming you ARE running SMTP services locally, take a look in your inetpub\mailroot tree for messages piling up in [pickup], [badmail], or [queue]. If your messages are there, you have gotten CDO working, and need to learn how to configure SMTP. But you knew that already, right? Heh. > So I wrote it dont work (not real english, but, slang for it Aaron does not need a lesson in English. You need to learn to explain > doesn`t work) yourself. Neither "dont work" nor "doesn't work" explicitly describes what it DOES and what messages it REPORTS. -- Dave Anderson Unsolicited commercial email will be read at a cost of $500 per message. Use of this email address implies consent to these terms. --
Show quote
"But you knew that already, right? Heh". -- I was wondering about that, but I think the server wants me to pay extra for it (the smtp service) "have correctly figured out how to send via remote SMTP server". (Yes I have, but I think the server wants me to pay extra for it (the smtp service) "I am already assuming that you have SMTP services running", -- again, I was wondering about that. In truth I haven,t set it up. I think the server wants me to pay extra for it (the smtp service) "Aaron does not need a lesson in English" -- He asked I understand very little of this. I`m trying to learn and your response has helped in this respect Thank you AL "Dave Anderson" wrote:
> alan wrote: > > When I used Request.ServerVariables("REQUEST_METHOD") = "POST"... > > You could just as easily look for content in the Request.Form collection, > BTW. > > > > > ...either the page didnt open or every thing appeared to be just > > fine, but no email was sent > > Do you know how to read an ASP error message? If you actually reached a line > in which you called the Send() method of a CDO.Message object, but got no > error message, then the message was sent. > > For some reason, I am already assuming that you have SMTP services running, > or have correctly figured out how to send via remote SMTP server. That is > probably an error on my part. But assuming you ARE running SMTP services > locally, take a look in your inetpub\mailroot tree for messages piling up in > [pickup], [badmail], or [queue]. If your messages are there, you have gotten > CDO working, and need to learn how to configure SMTP. > > > > > > So I wrote it dont work (not real english, but, slang for it > > doesn`t work) > > Aaron does not need a lesson in English. You need to learn to explain > yourself. Neither "dont work" nor "doesn't work" explicitly describes what > it DOES and what messages it REPORTS. > > > > -- > Dave Anderson > > Unsolicited commercial email will be read at a cost of $500 per message. Use > of this email address implies consent to these terms. > > > seems that you do not understand what they are trying to do. So instead of using other things such as requesting the method, we will do it all by form then......
here is what your basic code should look like............ you need to put YOUR form into the section that says "YOUR FORM CODE WILL NEED TO BE HERE"...... you will also need to add this line of code into your form: <input type="hidden" name="action" value="send"> i really hope this helps. *************EMAIL PAGE BEGIN************** <%@LANGUAGE="VBSCRIPT"%> <% Dim action action = Request.Form("action") IF action = "send" Then Dim email email = request.form("email") Set MyMail=CreateObject("CDO.Message") MyMail.TextBody=Request.Form("name") & vbCrLf & _ Request.Form("email")& vbCrLf & _ Request.Form("phone")& vbCrLf & _ Request.Form("palaver") MyMail.From=" rate***@yahoo.com" MyMail.To="a***@gmail.com" MyMail.Cc="" MyMail.Bcc="" MyMail.Subject="cosas de cuero" MyMail.Send() Set MyMail=Nothing Response.Redirect "confirm.asp?email=" & email Else %> ************YOUR FORM CODE WILL NEED TO BE HERE....*************** ex... <form action="email.asp" method="post"> <input type="hidden" name="action" value="send"> *******YOU NEED TO ADD THIS TO YOUR FORM AS A HIDDEN FIELD FOR THIS TO WORK!!! <input type="submit" value="Send Email"> </form> <% End IF %> ****************EMAIL PAGE END****************** ****************CONFRMATION PAGE BEGIN******************* <% Dim email email = Request.QueryString("email") %> Hello <%=email%>! <br /> We have received your submission. **************CONFIRMATION PAGE END*********************** James Jones Show quote "whyyyy" <why***@discussions.microsoft.com> wrote in message news:C6231351-D170-4E30-9F7A-6AD43D51415B@microsoft.com... > The script below works fine if the form is filled out and submitted. > > But a (blank) e-mail is sent whenever the page loads, even when the form is > not submitted. I would like to receive the e-mail only when the form is > submitted > > > <%@LANGUAGE="VBSCRIPT"%> > <% > Set MyMail=CreateObject("CDO.Message") > MyMail.TextBody=Request.Form("name") & vbCrLf & _ > Request.Form("email")& vbCrLf & _ > Request.Form("phone")& vbCrLf & _ > Request.Form("palaver") > MyMail.From=" rate***@yahoo.com" > MyMail.To="a***@gmail.com" > MyMail.Cc="" > MyMail.Bcc="" > MyMail.Subject="cosas de cuero" > MyMail.Send() > Set MyMail=Nothing > %> > > Part two: The script below could be part of the problem. It is in the html > body below the closing form tag </form> and works when the form is submitted, > but I would prefer not to use it, but instead to have a redirect to a > confirmation page. > > But if I use "response.redirect", the page with the form never opens. Only > the confirmation page opens. > > So I have two questions, and am obviously a novice. > > This forum has been a lifesaver in the past > > Thanks > > Alan Lipman > alegrate***@yahoo.com > calipasof***@hotmail.com > > <% > dim email > email=Request.Form("email") > If email<>"" Then > Response.Write("Hello " & email & "!<br />") > Response.Write("We have receved your submission") > End If > %> To James Jones and Aaron.
Thank you both for new approaches "seems that you do not understand what they are trying to do" -- You got that right -- Show quoteAL "James Jones" wrote: > seems that you do not understand what they are trying to do. So instead of using other things such as requesting the method, we will do it all by form then...... > > > here is what your basic code should look like............ > > you need to put YOUR form into the section that says "YOUR FORM CODE WILL NEED TO BE HERE"...... > > you will also need to add this line of code into your form: > > <input type="hidden" name="action" value="send"> > > > > > i really hope this helps. > > > > > > *************EMAIL PAGE BEGIN************** > > > <%@LANGUAGE="VBSCRIPT"%> > <% > Dim action > action = Request.Form("action") > > IF action = "send" Then > Dim email > email = request.form("email") > > Set MyMail=CreateObject("CDO.Message") > MyMail.TextBody=Request.Form("name") & vbCrLf & _ > Request.Form("email")& vbCrLf & _ > Request.Form("phone")& vbCrLf & _ > Request.Form("palaver") > MyMail.From=" rate***@yahoo.com" > MyMail.To="a***@gmail.com" > MyMail.Cc="" > MyMail.Bcc="" > MyMail.Subject="cosas de cuero" > MyMail.Send() > Set MyMail=Nothing > Response.Redirect "confirm.asp?email=" & email > Else > %> > > ************YOUR FORM CODE WILL NEED TO BE HERE....*************** > ex... > > <form action="email.asp" method="post"> > <input type="hidden" name="action" value="send"> *******YOU NEED TO ADD THIS TO YOUR FORM AS A HIDDEN FIELD FOR THIS TO WORK!!! > <input type="submit" value="Send Email"> > </form> > > <% > End IF > %> > > > ****************EMAIL PAGE END****************** > > > > ****************CONFRMATION PAGE BEGIN******************* > > <% > Dim email > email = Request.QueryString("email") > %> > > Hello <%=email%>! <br /> > We have received your submission. > > > **************CONFIRMATION PAGE END*********************** > > > > > > > > > > > > > > > James Jones > > > > > > > > > > > > > > > "whyyyy" <why***@discussions.microsoft.com> wrote in message news:C6231351-D170-4E30-9F7A-6AD43D51415B@microsoft.com... > > The script below works fine if the form is filled out and submitted. > > > > But a (blank) e-mail is sent whenever the page loads, even when the form is > > not submitted. I would like to receive the e-mail only when the form is > > submitted > > > > > > <%@LANGUAGE="VBSCRIPT"%> > > <% > > Set MyMail=CreateObject("CDO.Message") > > MyMail.TextBody=Request.Form("name") & vbCrLf & _ > > Request.Form("email")& vbCrLf & _ > > Request.Form("phone")& vbCrLf & _ > > Request.Form("palaver") > > MyMail.From=" rate***@yahoo.com" > > MyMail.To="a***@gmail.com" > > MyMail.Cc="" > > MyMail.Bcc="" > > MyMail.Subject="cosas de cuero" > > MyMail.Send() > > Set MyMail=Nothing > > %> > > > > Part two: The script below could be part of the problem. It is in the html > > body below the closing form tag </form> and works when the form is submitted, > > but I would prefer not to use it, but instead to have a redirect to a > > confirmation page. > > > > But if I use "response.redirect", the page with the form never opens. Only > > the confirmation page opens. > > > > So I have two questions, and am obviously a novice. > > > > This forum has been a lifesaver in the past > > > > Thanks > > > > Alan Lipman > > alegrate***@yahoo.com > > calipasof***@hotmail.com > > > > <% > > dim email > > email=Request.Form("email") > > If email<>"" Then > > Response.Write("Hello " & email & "!<br />") > > Response.Write("We have receved your submission") > > End If > > %> Dear James
The script below with the hidden field works perfectly. I needed only the response redirect so didn't use any asp below the </FORM> except this: <% End IF %> Again thank you and many blessings: Your help with this did the job I apologoze to the others for my God-given ignorance Thanks Again <%@LANGUAGE="VBSCRIPT"%> <% Dim action action = Request.Form("action") IF action = "send" Then Dim email email = request.form("email") Set MyMail=CreateObject("CDO.Message") MyMail.TextBody=Request.Form("name") & vbCrLf & _ Request.Form("email")& vbCrLf & _ Request.Form("phone")& vbCrLf & _ Request.Form("palaver") MyMail.From="v***@artetil.com" MyMail.To=" a***@gmail.com" MyMail.Cc="alegrate***@yahoo.com" MyMail.Bcc="" MyMail.Subject="Ropa de Arte y Cuero" MyMail.Send() Set MyMail=Nothing Response.Redirect "confirmed.asp?email=" & email Else %> -- Show quoteAL "James Jones" wrote: > seems that you do not understand what they are trying to do. So instead of using other things such as requesting the method, we will do it all by form then...... > > > here is what your basic code should look like............ > > you need to put YOUR form into the section that says "YOUR FORM CODE WILL NEED TO BE HERE"...... > > you will also need to add this line of code into your form: > > <input type="hidden" name="action" value="send"> > > > > > i really hope this helps. > > > > > > *************EMAIL PAGE BEGIN************** > > > <%@LANGUAGE="VBSCRIPT"%> > <% > Dim action > action = Request.Form("action") > > IF action = "send" Then > Dim email > email = request.form("email") > > Set MyMail=CreateObject("CDO.Message") > MyMail.TextBody=Request.Form("name") & vbCrLf & _ > Request.Form("email")& vbCrLf & _ > Request.Form("phone")& vbCrLf & _ > Request.Form("palaver") > MyMail.From=" rate***@yahoo.com" > MyMail.To="a***@gmail.com" > MyMail.Cc="" > MyMail.Bcc="" > MyMail.Subject="cosas de cuero" > MyMail.Send() > Set MyMail=Nothing > Response.Redirect "confirm.asp?email=" & email > Else > %> > > ************YOUR FORM CODE WILL NEED TO BE HERE....*************** > ex... > > <form action="email.asp" method="post"> > <input type="hidden" name="action" value="send"> *******YOU NEED TO ADD THIS TO YOUR FORM AS A HIDDEN FIELD FOR THIS TO WORK!!! > <input type="submit" value="Send Email"> > </form> > > <% > End IF > %> > > > ****************EMAIL PAGE END****************** > > > > ****************CONFRMATION PAGE BEGIN******************* > > <% > Dim email > email = Request.QueryString("email") > %> > > Hello <%=email%>! <br /> > We have received your submission. > > > **************CONFIRMATION PAGE END*********************** > > > > > > > > > > > > > > > James Jones > > > > > > > > > > > > > > > "whyyyy" <why***@discussions.microsoft.com> wrote in message news:C6231351-D170-4E30-9F7A-6AD43D51415B@microsoft.com... > > The script below works fine if the form is filled out and submitted. > > > > But a (blank) e-mail is sent whenever the page loads, even when the form is > > not submitted. I would like to receive the e-mail only when the form is > > submitted > > > > > > <%@LANGUAGE="VBSCRIPT"%> > > <% > > Set MyMail=CreateObject("CDO.Message") > > MyMail.TextBody=Request.Form("name") & vbCrLf & _ > > Request.Form("email")& vbCrLf & _ > > Request.Form("phone")& vbCrLf & _ > > Request.Form("palaver") > > MyMail.From=" rate***@yahoo.com" > > MyMail.To="a***@gmail.com" > > MyMail.Cc="" > > MyMail.Bcc="" > > MyMail.Subject="cosas de cuero" > > MyMail.Send() > > Set MyMail=Nothing > > %> > > > > Part two: The script below could be part of the problem. It is in the html > > body below the closing form tag </form> and works when the form is submitted, > > but I would prefer not to use it, but instead to have a redirect to a > > confirmation page. > > > > But if I use "response.redirect", the page with the form never opens. Only > > the confirmation page opens. > > > > So I have two questions, and am obviously a novice. > > > > This forum has been a lifesaver in the past > > > > Thanks > > > > Alan Lipman > > alegrate***@yahoo.com > > calipasof***@hotmail.com > > > > <% > > dim email > > email=Request.Form("email") > > If email<>"" Then > > Response.Write("Hello " & email & "!<br />") > > Response.Write("We have receved your submission") > > End If > > %> |
|||||||||||||||||||||||