Home All Groups Group Topic Archive Search About

CDO.Message sent whenever page loads, though the form not submitte



Author
10 Jul 2006 1:17 AM
whyyyy
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
    %>

Author
10 Jul 2006 2:49 PM
Ray Costanzo [MVP]
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
> %>
Author
10 Jul 2006 4:01 PM
whyyyy
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
> > %>
>
>
>
Author
10 Jul 2006 4:07 PM
Aaron Bertrand [SQL Server MVP]
> 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.
Author
11 Jul 2006 3:35 AM
whyyyy
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.
>
>
>
Author
11 Jul 2006 3:31 AM
whyyyy
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
> > %>
>
>
>
Author
11 Jul 2006 4:39 AM
Aaron Bertrand [SQL Server MVP]
>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

That's the part that starts with Set MyMail = CreateObject("CDO.Message")
and ends with Set MyMail = Nothing

> If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
> Set MyMail=CreateObject("CDO.Message")
> Response.Redirect "confirmed.asp"

Why are you doing this here?  You haven't set up the message or sent it yet.
Try moving this Response.Redirect line down to after the End If.

A
Author
12 Jul 2006 9:16 PM
whyyyy
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
> > %>
>
>
>
Author
12 Jul 2006 10:09 PM
Aaron Bertrand [SQL Server MVP]
> 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
Author
13 Jul 2006 1:19 AM
alan
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
>
>
>
Author
13 Jul 2006 2:37 AM
Aaron Bertrand [SQL Server MVP]
> 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
Author
13 Jul 2006 2:40 PM
alan
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)
--

But the truth is: I`m sure that
Mr. Jones is correct: "seems that you do not understand"

Sincerely

AL




Show quote
"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
>
>
>
Author
13 Jul 2006 4:01 PM
Dave Anderson
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.

But you knew that already, right? Heh.



> 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.
Author
13 Jul 2006 6:05 PM
alan
--

"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






Show quote
"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.
>
>
>
Author
13 Jul 2006 1:34 AM
James Jones
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
> %>
Author
13 Jul 2006 2:26 PM
alan
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


--
AL


Show quote
"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
> > %>
Author
13 Jul 2006 6:14 PM
alan
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
        %>
--
AL


Show quote
"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
> > %>

AddThis Social Bookmark Button