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!

Send the HTML content of a Dynamic page with CDO

Status
Not open for further replies.

fmrock

Programmer
Sep 5, 2006
510
US
Basicly I have an online survey form. The user sumbits the form and the data is saved into a database.

The department that gets the results would like a PDF version of the form or an HTML email that is the exact form but filed out.

Does anyone have any ideas on how to acomplish this. I was thinking using the "objXmlHttp" to request the page and use html it returns as the body of me email. I tried creating a simple page to send the google HTML but with no luck. Something like this.

Code:
<%


Dim objXmlHttp
Dim strHTML

' This is the server safe version from MSXML3.
Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objXmlHttp.open "GET", "[URL unfurl="true"]http://www.google.com",[/URL] False
objXmlHttp.send
strHTML = objXmlHttp.responseText
Set objXmlHttp = Nothing



	
	Set oMail = Server.CreateObject("CDO.Message") 
	Set oMailConfig = Server.CreateObject ("CDO.Configuration") 
	
	oMailConfig.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "mail.domain.com" 
	oMailConfig.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25 
	oMailConfig.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2 
	oMailConfig.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")[/URL] = 60 
	oMailConfig.Fields.Update 

	Set oMail.Configuration = oMailConfig 
	oMail.From = "test@test.com"
	oMail.To = "test@test.com"
	oMail.Subject = "TEST"
	oMail.HTMLBody = strHTML 
	oMail.Send 
	
	Set oMail = Nothing 
	Set oMailConfig = Nothing 

response.write strHTML

%>
 
I tried this also, but no email ever arives.

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="mymail@mydomain.com"
myMail.To="someone@somedomain.com"
myMail.CreateMHTMLBody "myMail.Send
set myMail=nothing
%>

If i take out the body part, then i get a blank email.
 
What about making another ASP that uses a key value to read the database and display a page that looks like the original? Then you could just email them a link with the key value in the QueryString.
 
Thats what I was going to use as the URL, I was just wanting to include it in the email.
 
try using jmail component instead?

also if your hosting with a third party most likely the from address must reside on there server
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top