I have an html form which is processed by an asp page to send an email.
Example Form Code
<div class="form-group">
<label class="checkbox-inline"><input type="checkbox" name="PartNo" value="SX941"> SX941 - 20µm w/wire</label>
<label class="checkbox-inline"><input type="checkbox" name="PartNo" value="SX942"> SX942 - 25µm w/wire</label>
<label class="checkbox-inline"><input type="checkbox" name="PartNo" value="SX943"> SX943 - 32µm w/wire</label>
A group of checkboxes results in a comma delimited list in the email such as
SX991, SX992, SX993, SX994, SX995
Code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>
<%
'Declare variables
Dim strSenderName, strSenderTel, strSenderComp, strEmailFrom, strComments, strMultiple
Dim strPartNoCheckBoxes
Dim strEmailFromTxt, strEmailTo, strMailSubject, strRedirectpage, strMessage
Dim objNewMail
'Set variables
strSenderName = Request("name") 'Name from form
strSenderTel = Request("tel") 'Tel No. from form
strSenderComp = Request("company") 'Company name from form
strEmailFrom = Request("email") 'Email address from form
strComments = Request("comment") 'Comments from form
strMultiple = Request("multiple") 'Multiple enquiry checkbox
strPartNoCheckBoxes = Request("PartNo")
strEmailFromTxt = strEmailFrom & "<" & strEmailFrom & ">" 'from address converted to compatible
strEmailTo= "sharon@impact-test.co.uk" 'where email is to be sent
strMailSubject="Quotation request Test1" 'email subject
strRedirectpage="thankyou.asp" 'page to redirect to when form is processed
'Stage 3 setup simple text email message content (VBcrLF is a carriage return)
strMessage = "Name: " & strSenderName & VBcrlf
strMessage = strMessage & "Tel: " + strSenderTel & VBcrlf
strMessage = strMessage & "Company: " & strSenderComp & VBcrlf
strMessage = strMessage & "Email Address: " & strEmailFrom & VBcrlf
strMessage = strMessage & VBcrlf & strMultiple & VBcrlf
strMessage = strMessage & VBcrlf & "Comments: " & VBcrlf & strComments & VBcrlf
strMessage = strMessage & VBcrlf & "Part Numbers to quote for: " & VBcrlf
strMessage = strMessage & VBcrlf & strPartNoCheckBoxes & VBcrlf
I would like to get the email message to send as
SX991 & VBcrlf SX992 & VBcrlf SX993 & VBcrlf SX994 & VBcrlf SX995 & VBcrlf
to make it easier for the recipient to paste the data into an Excel column.
Is there a way to replace the comma & following space with VBcrlf in the message?
PS I am a novice at this & would appreciate advice I can understand
Aucun commentaire:
Enregistrer un commentaire