Help passing Email address to new page then Emailing

I have a page the has an included form the uploads a file using ABCUpload and uses a hidden field to capture the email of a person in the DB. The code looks like this...

<form method="post" action="upload_success.asp?email=<%=Request.QueryString("Email")%>" enctype="multipart/form-data">
             
                    <div align="left">
                <p>
                  <input name="filefield" type="file" size="60">
                  <br>
                  <input type="hidden" name="hiddenField" value="<%=Request.QueryString("email")%>
">
                  <br>
                  <input type="submit" name="submit" value="Upload File">
                </p>
              </div>
</form>

The on my thanks/mailing page I have the following...

%
'Declare variables
Dim sMsg
Dim sTo
Dim sFrom
Dim sSubject
'Dim sTextBody 'use one or the other
Dim sHTMLBody

'Get data from previous page
sTo = Request.form("Email")
sFrom = "me@me.com"
sSubject = "MobileDataforce Leads Uploaded"
'sTextBody = Request("sTextBody") 'use one or the other
sHTMLBody = Request("sHTMLBody")

Dim objMail
'Create the mail object
Set objMail = Server.CreateObject("CDO.Message")
'=== Code added here to specify SMTP server and port

objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.fiberpipe.net"
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMail.Configuration.Fields.Update

' build HTML for message body
sHTMLBody = "<HTML>"
sHTMLBody = sHTMLBody & "<HEAD>"
sHTMLBody = sHTMLBody & "<BODY>"
sHTMLBody = sHTMLBody & "Message"
sHTMLBody = sHTMLBody & "</BODY>"
sHTMLBody = sHTMLBody & "</HTML>"

'=== End code to specify SMTP server and port
'Set key properties
objMail.From = sFrom
objMail.To = sTo
objMail.Subject= sSubject
'objMail.TextBody = sTextBody 'use one or the other
objMail.HTMLBody = sHTMLBody

'Send the email
objMail.Send
'Set sMsg which will be used later
sMsg = "Your message was sent to: " & sTo

'Clean-up
Set objMail = Nothing

%>

But I get the following errror..

CDO.Message.1 error '8004020c'

At least one recipient is required, but none were found.

/partnersite/regions/Ztest/upload_success.asp, line 78


Obviously I'm not catching or forwarding the email.

Thanks for your help.



kevinbenedictAsked:
Who is Participating?
 
SweatCoderConnect With a Mentor Commented:
or change this:

<form method="post" action="upload_success.asp?email=<%=Request.QueryString("Email")%>" enctype="multipart/form-data">

to this:
<form method="post" action="upload_success.asp?email=<%=Server.URLEncode(Request.QueryString("Email"))%>">

. . .and then to get the value, just do sTo = Request.Querystring("Email")
. . .and get rid of the HIDDEN form field.
0
 
SweatCoderCommented:
when you do a response.write on your sTo variable, what value comes in?
0
 
BubbaisBestCommented:
Change the Request.Form("Email") to Upload.Form("Email")

bubs
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
kevinbenedictAuthor Commented:
Please bear with me as I'm still getting a grasp on things..

This is what I tried on my thanks/emailing page

'Get data from previous page
response.Write(Request.QueryString("email"))
Response.End()
sTo = Request.form("Email")

I got nothing
0
 
BubbaisBestCommented:
Kevinbenedict,

Change this:

'Get data from previous page
response.Write(Request.QueryString("email"))
Response.End()
sTo = Request.form("Email")


To:
'Get data from previous page
response.Write(Request.QueryString("email"))
Response.End()
sTo = Upload.form("Email")

Then see what the value is in sTo

bubs
0
 
kevinbenedictAuthor Commented:
I didn't get anything on the when I changed it to

'Get data from previous page
response.Write(Request.QueryString("email"))
Response.End()
sTo = Upload.form("Email")
0
 
kevinbenedictAuthor Commented:
mmm That worked!

But now my ABCUpload is broke..

ABCUpload4.XForm.4 error '80004005'

Upload stopped unexpectedly.

/partnersite/regions/Ztest/upload_success.asp, line 95


line 95
theForm("filefield")(1).Save theForm("filefield")(1).FileName
0
 
BubbaisBestCommented:
The other thing you can do is to do something similar to SweatCoder but use session variables.  

Before the form tag you can do Session("Email") = Request("Email") then finish out the upload form and remove the hidden field.

then on the next page you can do sTo = Session("Email")

You may want to hardcode an email address in the sTo to make sure there is not other problems happening.  You should be able to do a Response.Write on Upload.Form("Email") and then shut off the .Send to see if there is a value.

Bubs
0
 
kevinbenedictAuthor Commented:
I actually started out doing the Session Variable but someone told me it might interfere with Session Variables already set so I went away from that.
0
 
BubbaisBestCommented:
According to the documentation on ABCUpload...

Whatever you set this to (ie theReq)
Set theReq = Request ' standard ASP Request object

you will need this:

'Get data from previous page
response.Write(Request.QueryString("email"))
Response.End()
sTo = theReq.form("Email")     ' Change Upload to your name in the set Request above

Bubs
0
 
kevinbenedictAuthor Commented:
I get the following error...

Microsoft VBScript runtime error '800a01a8'

Object required: 'theReq'

/partnersite/regions/Ztest/upload_success.asp, line 34

which is on the

sTo = theReq.form("Email")     ' Change Upload to your name in the set Request above
0
 
BubbaisBestCommented:
theReq needs to be changed to what you set it in this line in your code

Set theReq = Request ' standard ASP Request object

That looks like it is standard code in the ABCUpload that you are using to upload your file as your error above shows
If you want to post some of your code on the page where you are uploading the file, I will see if I can find that line for you.

Bubs
0
 
kevinbenedictAuthor Commented:
Here is the upload sending page..

<form method="post" action="upload_success.asp?email=<%=Server.URLEncode(Request.QueryString("Email"))%>">
             
                    <div align="left">
                <p>
                  <input name="filefield" type="file" size="60">
                  <br>
                 

                  <br>
                  <input type="submit" name="submit" value="Upload File">
                </p>
              </div>
</form>

Here is the upload_success page code..

<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="/partnersite/loginfailed.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
  If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If
%><%
'Declare variables
Dim sMsg
Dim sTo
Dim sFrom
Dim sSubject
'Dim sTextBody 'use one or the other
Dim sHTMLBody

'Get data from previous page
'response.Write(Request.QueryString("email"))
'Response.End()
sTo = Request.Querystring("Email")
sFrom = "me@me.com"
sSubject = "MobileDataforce Leads Uploaded"
'sTextBody = Request("sTextBody") 'use one or the other
sHTMLBody = Request("sHTMLBody")

Dim objMail
'Create the mail object
Set objMail = Server.CreateObject("CDO.Message")
'=== Code added here to specify SMTP server and port

objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.isp.net"
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMail.Configuration.Fields.Update

' build HTML for message body
sHTMLBody = "<HTML>"
sHTMLBody = sHTMLBody & "<HEAD>"
sHTMLBody = sHTMLBody & "<BODY>"
sHTMLBody = sHTMLBody & "<font face='Arial' size='2'>Greetings,</font></br>"
sHTMLBody = sHTMLBody & "0==============================0"
sHTMLBody = sHTMLBody & "</BODY>"
sHTMLBody = sHTMLBody & "</HTML>"

'=== End code to specify SMTP server and port
'Set key properties
objMail.From = sFrom
objMail.To = sTo
objMail.Subject= sSubject
'objMail.TextBody = sTextBody 'use one or the other
objMail.HTMLBody = sHTMLBody

'Send the email
objMail.Send
'Set sMsg which will be used later
sMsg = "Your message was sent to: " & sTo

'Clean-up
Set objMail = Nothing

%>



<!-- Upload Files -->
<%
Set theForm = Server.CreateObject("ABCUpload4.XForm")
theForm.Overwrite = True
theForm("filefield")(1).Save theForm("filefield")(1).FileName

%>
0
 
BubbaisBestCommented:
Okay that helps.  Here is what I would try to set the value of sTo.

'Get data from previous page
response.Write(Request.QueryString("email"))
Response.End()
 Comment from SweatCoder
Date: 09/01/2004 10:19AM CDT
 Comment  


when you do a response.write on your sTo variable, what value comes in?
 
Comment from BubbaisBest
Date: 09/01/2004 10:20AM CDT
 Your Comment  


Change the Request.Form("Email") to Upload.Form("Email")

bubs
 
Comment from kevinbenedict
Date: 09/01/2004 10:28AM CDT
 Author Comment  


Please bear with me as I'm still getting a grasp on things..

This is what I tried on my thanks/emailing page

'Get data from previous page
response.Write(Request.QueryString("email"))
Response.End()
sTo = Request.form("Email")

I got nothing
 
Comment from BubbaisBest
Date: 09/01/2004 10:33AM CDT
 Your Comment  


Kevinbenedict,

Change this:

'Get data from previous page
response.Write(Request.QueryString("email"))
Response.End()
sTo = Request.form("Email")


To:
'Get data from previous page
response.Write(Request.QueryString("email"))
Response.End()
sTo = Upload.form("Email")

Then see what the value is in sTo

bubs

 
Accepted Answer from SweatCoder
Date: 09/01/2004 10:36AM CDT
Grade: A
 Accepted Answer  


or change this:

<form method="post" action="upload_success.asp?email=<%=Request.QueryString("Email")%>" enctype="multipart/form-data">

to this:
<form method="post" action="upload_success.asp?email=<%=Server.URLEncode(Request.QueryString("Email"))%>">

. . .and then to get the value, just do sTo = Request.Querystring("Email")
. . .and get rid of the HIDDEN form field.

 
Comment from kevinbenedict
Date: 09/01/2004 10:37AM CDT
 Author Comment  


I didn't get anything on the when I changed it to

'Get data from previous page
response.Write(Request.QueryString("email"))
Response.End()
sTo = Upload.form("Email")

 
Comment from kevinbenedict
Date: 09/01/2004 10:44AM CDT
 Author Comment  


mmm That worked!

But now my ABCUpload is broke..

ABCUpload4.XForm.4 error '80004005'

Upload stopped unexpectedly.

/partnersite/regions/Ztest/upload_success.asp, line 95


line 95
theForm("filefield")(1).Save theForm("filefield")(1).FileName
 
Comment from BubbaisBest
Date: 09/01/2004 10:44AM CDT
 Your Comment  


The other thing you can do is to do something similar to SweatCoder but use session variables.  

Before the form tag you can do Session("Email") = Request("Email") then finish out the upload form and remove the hidden field.

then on the next page you can do sTo = Session("Email")

You may want to hardcode an email address in the sTo to make sure there is not other problems happening.  You should be able to do a Response.Write on Upload.Form("Email") and then shut off the .Send to see if there is a value.

Bubs
 
Comment from kevinbenedict
Date: 09/01/2004 10:46AM CDT
 Author Comment  


I actually started out doing the Session Variable but someone told me it might interfere with Session Variables already set so I went away from that.
 
Comment from BubbaisBest
Date: 09/01/2004 10:48AM CDT
 Your Comment  


According to the documentation on ABCUpload...

Whatever you set this to (ie theReq)
Set theReq = Request ' standard ASP Request object

you will need this:

sTo = theForm.form("Email")     ' Change Upload to your name in the set Request above

Also make sure you move this above setting the value of sTo.

Bubs
 
0
 
kevinbenedictAuthor Commented:
when you do a response.write on your sTo variable, what value comes in?
 
Comment from BubbaisBest
Date: 09/01/2004 10:20AM CDT
 Your Comment  

I actually get the correct email. And it get's sent to the user. The file doesn't get uploaded.

Let me try some of the things..
0
 
kevinbenedictAuthor Commented:
I don't know what to change to make this happen with ABCUpload

Any ideas?
0
 
BubbaisBestCommented:
Here is a really good link on mixing upload file and other data:

http://www.websupergoo.com/helpupload/source/3-examples/mixedupload.htm

bubs
0
 
kevinbenedictAuthor Commented:
I've gotten confused on where we are.

I tried doing this

According to the documentation on ABCUpload...

Whatever you set this to (ie theReq)
Set theReq = Request ' standard ASP Request object

you will need this:

sTo = theForm.form("Email")     ' Change Upload to your name in the set Request above

Also make sure you move this above setting the value of sTo.

Bubs

But it didn't work.
0
 
BubbaisBestCommented:
Yeah, I am not sure what happened on my one post that brought in a bunch of others.  Must have highlighted more than I thought.

You should be having this line set to

sTo = theForm.form("Email")     ' Change Upload to your name in the set Request above


That you said did give you a value and sent the email okay but the upload still did not happen.

Bubs
0
 
kevinbenedictAuthor Commented:
Check this out.

I moved the ABCUpload code above the CDOSys code and I get this...

ABCUpload4.XField.4 error '80004005'

Unable to convert virtual to physical path. A Windows error - Unspecified error - (0x80004005) occurred.

/partnersite/regions/Ztest/upload_success.asp, line 27


?????
0
 
kevinbenedictAuthor Commented:
When I change to..

sTo = theForm.form("Email")     ' Change Upload to your name in the set Request above


Microsoft VBScript runtime error '800a01a8'

Object required: ''

/partnersite/regions/Ztest/upload_success.asp, line 37
0
 
kevinbenedictAuthor Commented:
Do I still need this? Where does it go?

Set theReq = Request ' standard ASP Request object
0
 
kevinbenedictAuthor Commented:
Are we out of ideas? I really appreciate all your help!!
0
 
BubbaisBestCommented:
Sorry, I had to leave for a meeting.  

The set theReg.. is not needed due to you already having Set theForm = ...  This line of code does the same thing so you need to have the

Set theReq =...     This line should be removed but make sure that you place the sTo = theForm.form("Email") after the line of
Set theForm = ...

So you may have something to the affect of

Set theForm = Server.CreateObject("ABCUpload4.XForm")
sTo = theForm.form("Email")
theForm.Overwrite = True
theForm("filefield")(1).Save theForm("filefield")(1).FileName

.
.    '   your assigning code here
.

'Set key properties
objMail.From = sFrom
objMail.To = sTo
objMail.Subject= sSubject
'objMail.TextBody = sTextBody 'use one or the other
objMail.HTMLBody = sHTMLBody

and so on.

bubs
0
 
kevinbenedictAuthor Commented:
ditto, Let me try your suggestion.
0
 
kevinbenedictAuthor Commented:
if I do that I get Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'form'

/partnersite/regions/Ztest/upload_success.asp, line 38


Line 38 is

sTo = theForm.form("Email")
0
 
BubbaisBestCommented:
Please try

sTo = theForm("Email")

Make sure this is after the line of
  Set theForm = Server.CreateObject("ABCUpload4.XForm")

 
If this doesn't work, then I am not sure where to go with it next.  Sorry.

Bubs  
0
 
kevinbenedictAuthor Commented:
mmm

No I get

ABCUpload4.XField.4 error '80004005'

Unable to convert virtual to physical path. A Windows error - Unspecified error - (0x80004005) occurred.

/partnersite/regions/Ztest/upload_success.asp, line 40

the code with line numbers is
line 37: Set theForm = Server.CreateObject("ABCUpload4.XForm")
line 38: sTo = theForm("Email")
line 39: theForm.Overwrite = True
line 40: theForm("filefield")(1).Save theForm("filefield")(1).FileName
0
 
kevinbenedictAuthor Commented:
I wonder if the passing form to this final page is causing the latest error...

The code we created there was...

<form method="post" action="upload_success.asp?email=<%=Server.URLEncode(Request.QueryString("Email"))%>">

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.