我有一个html表单,由asp页面处理以发送电子邮件。
示例表单代码
<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>
一组复选框会在电子邮件中生成以逗号分隔的列表,例如
SX991,SX992,SX993,SX994,SX995
代码
<%@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
我希望收到要发送的电子邮件
SX991&amp; VBcrlf SX992&amp; VBcrlf SX993&amp; VBcrlf SX994&amp; VBcrlf SX995&amp; VBcrlf
使收件人可以更轻松地将数据粘贴到Excel列中。
有没有办法取代逗号&amp;在消息中使用VBcrlf跟踪空格?
PS我是这个&amp;的新手我很欣赏我能理解的建议
答案 0 :(得分:0)
这将取代&#34;,&#34;换行,如果那就是你想要的
output = Replace(output, ", ", vbCrLf)