469,918 Members | 2,217 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,918 developers. It's quick & easy.

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 2897
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by william c | last post: by
2 posts views Thread by TonyJeffs | last post: by
5 posts views Thread by Samy | last post: by
4 posts views Thread by brett | last post: by
8 posts views Thread by Wessel Troost | last post: by
1 post views Thread by Joy M | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.