我正在使用经典的 ASP 让用户在线填写表格,然后提交电子邮件。
在表单上有一些输入文本框可能是空白的。在我的电子邮件输出中,我列出了:
Box1:答案
Box2:答案 Box3
:“空白”
Box4:“空白”
电子邮件的下一段从这里开始......
我希望代码忽略 Box3 & 4 和换行符并直接移至下一段。
Box1:答案
Box2:答案
电子邮件的下一段从这里开始......
我在下面添加了我的代码。请查看我添加了条件检查的“Os1”。我知道这很混乱,但我是 ASP 的新手。
如果这是一个简单的答案,也许有人也可以回答我如何将 HTMLBody 部分移动到下面的行,这样我就可以将其布置得更容易阅读,因为它都在一行上。如果我尝试移至下一行并输入正文,则表单无法正常工作。
<!--
METADATA
TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library"
-->
<%
semaila = request.form("first name")
semailb = request.form("surname")
broker = request.form("broker name")
cust = request.form("cust name")
sapp = request.form("app number")
' Checks that the form value os1 is not empty, then appends the form value plus linebreaks,
' otherwise it is left empty.
If request.form("os1") <> "" Then
os1 = request.form("os1") + "<br><br>"
Else
os1 = "";
End If
os2 = request.form("os2")
os3 = request.form("os3")
os4 = request.form("os4")
os5 = request.form("os5")
os6 = request.form("os6")
os7 = request.form("os7")
sadded = request.form("added")
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "00.000.00.000"
.Update
End With
With cdoMessage
' Checks that the form value os1 is not empty, then appends the form value plus line breaks,
' otherwise it is left empty.
If request.form("os1") <> "" Then
os1 = request.form("os1") + "<br><br>"
Else
os1 = "";
End If
Set cdoMessage = CreateObject("CDO.Message")
With cdoMessage
Set .Configuration = cdoConfig
.From = "name@example.com"
.To = "name@example.com"
.Subject = QueryType
.HTMLBody = "<HTML><head><title></title></head><body><body bgcolor=""white"" TEXT=""black"" ALINK=""black"" VLINK=""black""> <font face=""ariel""> Dear "& broker &", <br><Br>We have today reviewed the mortgage application you submitted to us for your client in the name of: <br><br> <b> Name:</b> "& cust &"                 <b>Application Number:</b> "& sapp &" <br><br> In order for us to process your application further we need to be in receipt of the following outstanding items and would be grateful if you could arrange to forward these at your earliest convenience. <br><br> "& os1 & " <br><br> "& os2 & " <br><br> "& os3 & " <br><br> "& os4 & " <br><Br> "& os5 & " <br><br> "& os6 & " <br><br> "& os7 & " <br><Br> Other outstanding items that we have chased today....(The rest of the email will follow..) </font></body></HTML>"
.Send
End With
Set cdoMessage = Nothing
Set cdoConfig = Nothing
Response.write "<HTML><head><title></title></head><body><body bgcolor=""#161712"" TEXT=""white"" ALINK=""white"" VLINK=""white""><center><br><br><Br><Br><Br><br><br><br><Br><br><Br><br>Your request has been submitted....<br><br><br><a href = ""javascript:window.close();""> Click here to close window </a> </center></body></HTML>"
%>