473,379 Members | 1,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

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

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=" ra*****@yahoo.com"
MyMail.To="ar**@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 </formand 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
alegra*****@yahoo.com
ca**********@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
%>
Jul 10 '06 #1
16 3122
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" <wh****@discussions.microsoft.comwrote in message
news:C6**********************************@microsof t.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 </formand 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
al*********@yahoo.com
ca**********@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
%>

Jul 10 '06 #2
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

"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" <wh****@discussions.microsoft.comwrote in message
news:C6**********************************@microsof t.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 </formand 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
al*********@yahoo.com
ca**********@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
%>


Jul 10 '06 #3
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.
Jul 10 '06 #4
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="ar**@gmail.com"
MyMail.To="ar**@gmail.com"
MyMail.Cc="al*********@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
"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" <wh****@discussions.microsoft.comwrote in message
news:C6**********************************@microsof t.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 </formand 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
al*********@yahoo.com
ca**********@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
%>


Jul 11 '06 #5
Thank you Aaron

Unfortunately, I`m still in the dark

I sent another reply to Ray,

Thanks again

AL
"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.
Jul 11 '06 #6
>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
Jul 11 '06 #7
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
"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" <wh****@discussions.microsoft.comwrote in message
news:C6**********************************@microsof t.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 </formand 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
al*********@yahoo.com
ca**********@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
%>


Jul 12 '06 #8
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
Jul 12 '06 #9
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", "so*********@yahoo.com"
Mail.AddRecipient "Saboriarte", "so********@saboriarte.com"
Mail.AddRecipient "Saboriarte", "al*********@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
"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
Jul 13 '06 #10
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=" ra*****@yahoo.com"
MyMail.To="ar**@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" <wh****@discussions.microsoft.comwrote in message news:C6**********************************@microsof t.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=" ra*****@yahoo.com"
MyMail.To="ar**@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 </formand 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
alegra*****@yahoo.com
ca**********@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
%>
Jul 13 '06 #11
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
Jul 13 '06 #12
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
"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=" ra*****@yahoo.com"
MyMail.To="ar**@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" <wh****@discussions.microsoft.comwrote in message news:C6**********************************@microsof t.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=" ra*****@yahoo.com"
MyMail.To="ar**@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 </formand 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
alegra*****@yahoo.com
ca**********@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
%>
Jul 13 '06 #13
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


"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
Jul 13 '06 #14
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.
Jul 13 '06 #15

--

"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.
Jul 13 '06 #16
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="vi**@artetil.com"
MyMail.To=" ar**@gmail.com"
MyMail.Cc="al*********@yahoo.com"
MyMail.Bcc=""
MyMail.Subject="Ropa de Arte y Cuero"
MyMail.Send()
Set MyMail=Nothing
Response.Redirect "confirmed.asp?email=" & email
Else
%>
--
AL
"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=" ra*****@yahoo.com"
MyMail.To="ar**@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" <wh****@discussions.microsoft.comwrote in message news:C6**********************************@microsof t.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=" ra*****@yahoo.com"
MyMail.To="ar**@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 </formand 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
al*********@yahoo.com
ca**********@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
%>
Jul 13 '06 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: william c | last post by:
I don't really know PHP that well. I'm fixing a Perl program that accesses a db after getting form input from a PHP page. If the server-side validation fails I'd like to reload the form with all...
1
by: R | last post by:
Hi, I have an image loaded on my page that comes from a remote site using JavaScript I'm using... <script src='http://www.whatever.com/JD088?template=GX5'></script> The image loads fine...
2
by: TonyJeffs | last post by:
I'm new to this, and stole/doctored my code from the "Ugly JavaScript Handbook" I have a slide show program. First theres stuff to set up the array, and the time between slides Then a function...
4
by: techy techno | last post by:
hiii I wanted to know how can I check for a specific HTML tag or user defined TEXT and delete it when the page loads Whenver the IE loads the page my company add its COMPANY NAME in my office...
5
by: Samy | last post by:
Hi There, I have a stored procedure which takes 7 sec to execute. I am using a adapter and filling the dataset. Then I bind the datagrid with the datatable from the dataset. When I test the page...
1
by: mark | last post by:
Hi I am trying to count the number of times a page loads. When I hit the submit button I can get the page to count once using ispostback to check . I am trying to incriment a variable everytime...
4
by: brett | last post by:
How can I use an HTML FORM tag on a content page that uses a Master page? The HTML FORM is now inside the Master page serverside FORM. I need to use the HTML FORM on a few pages. Thanks, Brett
8
by: Wessel Troost | last post by:
We are using an XML data source in the Page_Load event of an ASP.NET page, like: protected void Page_Load(object sender, EventArgs e) { // Retrieve XML from web service for product idea in URL...
1
by: Joy M | last post by:
Hi - I am writing my first two programs in ASP.NET, using Visual Basic. The first is a questionaire form, the second sends the data collected from the form out in an email. The questionaire...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.