Results 1 to 3 of 3

Thread: mailForm.asp:

  1. #1
    Jeannette Guest

    Default mailForm.asp:

    I know basically nothing about asp, and I am trying to figure out 2 things regarding the mailForm.asp script available at this site (<BR><BR>1)How to avoid having to hard code where the form is emailed to, so that I can reuse the script for multiple forms,<BR><BR>2)How to do a response.write so that the user sees their responses upon submission and can print the page. I can get this to happen now, but the responses aren&#039;t formatted at all.<BR>-----------------------------------------------------------<BR> &#039;Who does this go to?<BR> Const strTo = ""<BR><BR> &#039;This information is optional<BR> Dim strFrom, strSubject, strFromPath<BR><BR> strFrom = Request.Form("txtSendToEmailAddress")<BR> if Len(strFrom) = 0 then strFrom = strTo<BR><BR> strSubject = Request.Form("txtEmailSubject")<BR> if Len(strSubject) = 0 then strSubject = "Application Submission"<BR><BR> strFromPath = Request.Form("urlFromPath")<BR> if Len(strFromPath) = 0 then strFromPath = "UNKNOWN"<BR><BR><BR><BR> Dim strBody<BR> strBody = vbCrLf & vbCrLf<BR> strBody = strBody & "FORM: " & strFromPath & vbCrLf & _<BR> "FORM submitted at " & Now() & vbCrLf & vbCrLf<BR> <BR><BR>Dim ix, fieldName, fieldValue <BR>For ix = 1 To Request.Form.Count <BR> fieldName = Request.Form.Key(ix) <BR> fieldValue = Request.Form.Item(ix) <BR><BR> Select Case Left(fieldName,3) <BR> Case "txt","sel","rad": <BR> strBody = strBody & Replace(Mid(fieldName,4,len(fieldName)),"."," ") & _ <BR> ": " <BR> if Len(fieldValue) = 0 then <BR> strBody = strBody & "UNANSWERED" <BR> else <BR> strBody = strBody & fieldValue <BR> end if <BR><BR> strBody = strBody & vbCrLf <BR><BR> Case "chk": <BR> strBody = strBody & Replace(Mid(fieldName,4,len(fieldName)),"."," ") & _ <BR> ": " & fieldValue & vbCrLf <BR> End Select <BR> Next <BR><BR> <BR><BR> <BR> <BR> <BR> strBody = strBody & vbCrLf<BR><BR> &#039;Time to send the email<BR> Dim objCDO<BR> Set objCDO = Server.CreateObject("CDONTS.NewMail")<BR> objCDO.To = strTo<BR> objCDO.From = strFrom<BR><BR> objCDO.Subject = strSubject<BR> objCDO.Body = strBody<BR><BR> objCDO.Send<BR><BR> Set objCDO = Nothing<BR><BR> <BR><BR> &#039;Thank them and show them their results<BR> Response.Write("&#060;p&#062;Thank you for submitting your application. Your responses are listed below. If they are not correct, hit your browsers back button to re-enter your information.&#060;/p&#062;&#060;hr&#062;" & strBody)<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: mailForm.asp:

    1. Const strTo = "" <BR>Dim name, url, tld<BR>name="someone"<BR>url="somewhere"<BR>tld="c om"<BR><BR>strTo = name&"@"&url&"."&tld<BR><BR>you can set these variables using a form or querystring<BR>name=request.form("ToName")<BR><BR> <BR>2. just format the html

  3. #3
    Jeannette Guest

    Default RE: mailForm.asp:

    But the entire contents of the form are one variable (strrBody).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts