Forums

ASP

This topic is locked

Form examples using CDONTS or JMAIL

Posted 09 Mar 2001 04:52:01
1
has voted
09 Mar 2001 04:52:01 Bryan Mr. posted:
Hi all,

I'm trying to create an email form to collect data and then send it off as html. I'm having trouble getting this to work. Most examples I see only show collection of the to: subject: and body:

I need to collect more info than that:

Name
Company
Phone
Fax
Address

I then need to send the message out in text or html like

Thank you for signing up & strname for signing up

Your address is:
& Address

etc.

I need to know how to do this with more info in it.

I'm trying to use cdonts. this is what I used:

'get current date
strDate = Date()

'get form information
strFormName = Request("FormName"
strSubject = Request("Subject"
strSendTo = Request("SendTo"
strname = Request("txtname"
strphone = Request("txtphone"
stremail = Request("txtemail"
strcompany = Request("txtcompany"
straccountinfo = Request("txtaccountinfo"
strsalesrep = Request("txtsalesrep"
straccesstype = Request("txtaccesstype"
strstate = Request("txtstate"
strzipcode = Request("txtzipcode"
strpassword = Request("txtpassword"

'if no information entered for email use your own
if instr(Request("txtemail", "@" <> 0 then
strFrom = Request("txtemail"
else
strFrom = strSendTo
end if

'concat URL information
strURLInfo = strHTTP & strFormName & "?" & Request.Form()

'create the HTML for email
strHTML = "<HTML> <HEAD> <TITLE></TITLE> </HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<TABLE WIDTH=500 CELLPADDING=0 CELLSPACING=0>"
strHTML = strHTML & "<TR>"

'use some graphics for email
strHTML = strHTML & "<TD><IMG SRC=" & strHTTP & "emailbanner.JPG BORDER=0></TD>"
strHTML = strHTML & "</TR>"

'include basic info in email
strHTML = strHTML & "<TR>"
strHTML = strHTML & "<TD>"
strHTML = strHTML & "<BR>Date: " & strdate
strHTML = strHTML & "<BR>Requested by: " & strname
strHTML = strHTML & "<BR>Email: " & stremail
strHTML = strHTML & "<BR>Company: " & strcompany
strHTML = strHTML & "<BR>VPD Account: " & straccountinfo
strHTML = strHTML & "<BR>Business Phone: " & strphone
strHTML = strHTML & "<BR>Sales Rep: " & strsalesrep
strHTML = strHTML & "<BR>Needs Access to: " & straccesstype
strHTML = strHTML & "<BR>State: " & strstate
strHTML = strHTML & "<BR>Zipcode: " & strzipcode
strHTML = strHTML & "<BR>PASSWORD: " & strpassword

if strFrom <> strSendTo then
strHTML = strHTML & "<BR>Email: <a href=mailto:" & strFrom & ">" & strFrom & "</a>"
else
strHTML = strHTML & "<BR>Email: UNKNOWN"
end if

'add hyperlink to form in email
strHTML = strHTML & "<BR><BR>"
strHTML = strHTML & "<A HREF=" & strURLInfo & "><IMG SRC=" & strHTTP & "form.gif WIDTH=16 HEIGHT=16 BORDER=0>Click here</A>"
strHTML = strHTML & " to view completed form."
strHTML = strHTML & "</TD>"
strHTML = strHTML & "</TR>"
strHTML = strHTML & "<TR>"
strHTML = strHTML & "<TD></TD>"
strHTML = strHTML & "</TR>"
strHTML = strHTML & "</TABLE>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"


'time to send the email
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail"

objCDO.To = strSendTo
objCDO.From = strFrom
objCDO.Subject = strName & " - " & strSubject
objCDO.BodyFormat = 0
objCDO.MailFormat = 0
objCDO.Body = strHTML
objCDO.Send

set objCDO = nothing

'redirect to the "Thanks" page
Response.Redirect strHTTP & "submitdone.htm"
%>

It doesnt work with my form. any good examples with more info would be appreciated.

Replies

Replied 11 Mar 2001 15:36:02
11 Mar 2001 15:36:02 Waldo Smeets replied:
We have a very cool html emailer extension in beta now. Just check back in a few weeks <img src=icon_smile.gif border=0 align=middle>

Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A Dreamweaver, Ultradev and Fireworks recourse site for developers
by developers.
------------------------------------------

Reply to this topic