Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email with pass-in parameter possible???

Status
Not open for further replies.

g2000

Programmer
Aug 31, 2005
39
US
I wanna email a page that is a report. The page itself is a file that accepts POST parameters.

If you email a page using something like

.CreateMHTMLBody

how can I send the parameters?
 
So you have an HTML form with [tt]action[/tt] = yourpage.asp and [tt]method[/tt] = POST ?

If so you can get the values from the form using:
[tt]MyVal = Request.Form("fieldName")[/tt]

Then you can use the value when you build the string that will become the body of email.
 
Yeah.. for that page, page2Send.asp, I do have 2 variables

var1 = Request.Form("var1")
var2 = Request.Form("var2")

However.... when I send the page using CDO

.CreateMHTMLBody "page2Send.asp"

How to pass those 2 variables? This is not a GET.
 
I think you would be best off with a 3rd page that only exists for the purpose of being your email page.

So that the 1st page is your HTML form, the 2nd is your "processing" page, and the 3rd page is your letter.

Then you'd do something like:

[tt]
'Get form values
var1 = Request.Form("var1")
var2 = Request.Form("var2")
var3 = Request.Form("var3")

'Use defaults if user skipped fields
If (len(var1) = 0) then var1 = "Special Customer"
If (len(var2) = 0) then var2 = "our products"

'Return to form if required field was skipped
If (len(var2) = 0) then Response.Redirect "MyForm.htm"

'Make email now
<< other cdo details omitted >>
oCDO.CreateMHTMLBody "letter.asp?v1=" & var1 & "&v2=" & var2 & "&v3=" & var3
[/tt]


So then you would have a letter.asp page like this:
[tt]
<html>
<head>
<title>
My HTML Email Page
</title>
</head>
<body>
Dear <%= Request.QueryString("v1")%>,
<br/><br/>
This message is to inform you of great savings on
<%= Request.QueryString("v2")%>.
Please visit one of our stores and spend a lot of money.
<br/><br/>
Sincerly,
<br/>
<%= Request.QueryString("v3")%>
</body>
</html>
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top