Solved

Help passing Email address to new page then Emailing

Posted on 2004-09-01
29
733 Views
Last Modified: 2007-12-19
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.



0
Comment
Question by:kevinbenedict
  • 17
  • 10
  • 2
29 Comments
 
LVL 11

Expert Comment

by:SweatCoder
ID: 11953563
when you do a response.write on your sTo variable, what value comes in?
0
 
LVL 6

Expert Comment

by:BubbaisBest
ID: 11953587
Change the Request.Form("Email") to Upload.Form("Email")

bubs
0
 

Author Comment

by:kevinbenedict
ID: 11953698
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
 
LVL 6

Expert Comment

by:BubbaisBest
ID: 11953793
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
 
LVL 11

Accepted Solution

by:
SweatCoder earned 300 total points
ID: 11953838
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
 

Author Comment

by:kevinbenedict
ID: 11953855
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
 

Author Comment

by:kevinbenedict
ID: 11953970
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
 
LVL 6

Expert Comment

by:BubbaisBest
ID: 11953977
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
 

Author Comment

by:kevinbenedict
ID: 11953999
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
 
LVL 6

Expert Comment

by:BubbaisBest
ID: 11954022
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
 

Author Comment

by:kevinbenedict
ID: 11954181
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
 
LVL 6

Expert Comment

by:BubbaisBest
ID: 11954389
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
 

Author Comment

by:kevinbenedict
ID: 11954433
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
 
LVL 6

Expert Comment

by:BubbaisBest
ID: 11954570
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:kevinbenedict
ID: 11954609
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
 

Author Comment

by:kevinbenedict
ID: 11954702
I don't know what to change to make this happen with ABCUpload

Any ideas?
0
 
LVL 6

Expert Comment

by:BubbaisBest
ID: 11954727
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
 

Author Comment

by:kevinbenedict
ID: 11954766
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
 
LVL 6

Expert Comment

by:BubbaisBest
ID: 11954861
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
 

Author Comment

by:kevinbenedict
ID: 11955114
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
 

Author Comment

by:kevinbenedict
ID: 11955194
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
 

Author Comment

by:kevinbenedict
ID: 11955363
Do I still need this? Where does it go?

Set theReq = Request ' standard ASP Request object
0
 

Author Comment

by:kevinbenedict
ID: 11955521
Are we out of ideas? I really appreciate all your help!!
0
 
LVL 6

Expert Comment

by:BubbaisBest
ID: 11956126
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
 

Author Comment

by:kevinbenedict
ID: 11956751
ditto, Let me try your suggestion.
0
 

Author Comment

by:kevinbenedict
ID: 11956791
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
 
LVL 6

Expert Comment

by:BubbaisBest
ID: 11957032
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
 

Author Comment

by:kevinbenedict
ID: 11957088
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
 

Author Comment

by:kevinbenedict
ID: 11957187
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

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now