therayster
MIS
I'm trying to use ASP to write a mailto: link that will compose the entire email from form data. The ASP code is pretty simple:
This is then appended to the link via:
With no data in the form, this produces a lovely formatted email. When I pass data to the string from the form I get a mess in the body of the mail.
I'm assuming it's a simple error with my hex code conversion script, but darned if I can find it. Any help or pointers would be appreciated.
Code:
<%@LANGUAGE="VBSCRIPT"%>
<%
Dim strEmail
strEmail="Name: " & Request.Form("name")
strEmail=strEmail & "%0DAddress Line 1: " & Request.Form("address1")
strEmail=strEmail & "%0DAddress Line 2: " & Request.Form("address2")
strEmail=strEmail & "%0DCity: " & Request.Form("city")
strEmail=strEmail & "%0DState: " & Request.Form("state")
strEmail=strEmail & "%0DZIP Code: " & Request.Form("zip")
strEmail=strEmail & "%0DPhone Number: " & Request.Form("phone")
strEmail=strEmail & "%0DeMail Address: " & Request.Form("email")
strEmail=strEmail & "%0DCareer Objective: " & Request.Form("objective")
strEmail=strEmail & "%0DApplying for what position: " & Request.Form("position")
strEmail=strEmail & "%0DDate Available: " & Request.Form("avalDate")
strEmail=strEmail & "%0DCertifications or Registrations: " & Request.Form("certreg")
strEmail=strEmail & "%0DYears of Experiance: " & Request.Form("yearexp")
strEmail=strEmail & "%0DPositions previously held: " & Request.Form("posheld")
strEmail=strEmail & "%0DDegree or Highest Grade Completed: " & Request.Form("deggrade")
strEmail=strEmail & "%0DYear of Graduation: " & Request.Form("yeargrad")
strEmail=strEmail & "%0DCollege or University : " & Request.Form("college")
strEmail=strEmail & "%0DMajor: " & Request.Form("major")
strEmail=strEmail & "%0DArea of Emphasis: " & Request.Form("emphasis")
strEmail=strEmail & "%0DProfessional Affiliations: " & Request.Form("professional")
strEmail=strEmail & "%0DHow did you hear about HEA?: " & Request.Form("hear")
strEmail=strEmail & "%0DWhy should we hire you?: " & Request.Form("whyhire")
strEmail= replace(strEmail, " ", "%20")
strEmail= replace(strEmail, "!", "%21")
'strEmail= replace(strEmail, """", "%22")
strEmail= replace(strEmail, "#", "%23")
strEmail= replace(strEmail, "$", "%24")
strEmail= replace(strEmail, "%", "%25")
strEmail= replace(strEmail, "&", "%26")
'strEmail= replace(strEmail, "'", "%27")
strEmail= replace(strEmail, "(", "%28")
strEmail= replace(strEmail, ")", "%29")
strEmail= replace(strEmail, ",", "%2C")
strEmail= replace(strEmail, ":", "%3A")
strEmail= replace(strEmail, ";", "%3B")
strEmail= replace(strEmail, "< ", "%3C")
strEmail= replace(strEmail, "=", "%3D")
strEmail= replace(strEmail, ">", "%3E")
strEmail= replace(strEmail, "[", "%5B")
strEmail= replace(strEmail, "\", "%5C")
strEmail= replace(strEmail, "]", "%5D")
strEmail= replace(strEmail, "^", "%5E")
strEmail= replace(strEmail, "`", "%60")
strEmail= replace(strEmail, "{", "%7B")
strEmail= replace(strEmail, "|", "%7C")
strEmail= replace(strEmail, "}", "%7D")
strEmail= replace(strEmail, "~", "%7E")
strEmail= replace(strEmail, "?", "%3F")
%>
Code:
<%Response.Write "<a href='mailto:test@test.com?Subject=Test%20Email&Body=" & strEmail & "'>Email link</a>"%>
Code:
Name:%20Test%20User%0DAddress%20Line%201:%201234%20Test%20St%0DAddress%20Line%202:%20Ap%20t%23%202%0DCity:%20Anywhere%0DState:%20PA%0DZIP%20Code:%2012345%0DPhone%20Number:%20800-555-1234%0DeMail%20Address:%20nonya@bizness.com%0DCareer%20Objective:%20%0DApplying%20for%20what%20position:%20%0DDate%20Available:%20%0DCertifications%20or%20Registrations:%20%0DYears%20of%20Experiance:%20%0DPositions%20previously%20held:%20%0DDegree%20or%20Highest%20Grade%20Completed:%20%0DYear%20of%20Graduation:%20%0DCollege%20or%20University%20:%20%0DMajor:%20%0DArea%20of%20Emphasis:%20%0DProfessional%20Affiliations:%20%0DHow%20did%20you%20hear%20about%20HEA?:%20%0DWhy%20should%20we%20hire%20you?:%20