如何使用表單發(fā)送電子郵件?
formToEmail.htm
' 表單.
FORM METHOD="POST" ACTION="formToEmail.asp">
P>
收件人: INPUT SIZE=30 NAME="recipient" MAXLENGTH=200>
P>
發(fā)件人: INPUT SIZE=30 NAME="sender" MAXLENGTH=200>
P>
主題: INPUT SIZE=30 NAME="subject" MAXLENGTH=512>
P>
內(nèi)容一: TEXTAREA ROWS=2 COLS=60 NAME="messageline1"> /TEXTAREA>
P>
內(nèi)容二: TEXTAREA ROWS=2 COLS=60 NAME="messageline2"> /TEXTAREA>
/PRE>
INPUT TYPE=submit VALUE="發(fā)送">
formToEmail.asp
' 處理接收和發(fā)送郵件.
%
Set mailer = Server.CreateObject("ASPMAIL.ASPMailCtrl.1")
recipient = Request.Form("recipient")
sender = Request.Form("sender")
subject = Request.Form("subject")
message = Request.Form("messageline1")
message = message vbCRLF
message = message vbCRLF
message = message Request.Form("messageline2")
mailserver = "www.intels.net"
' 寫上郵件服務器.
result = mailer.SendMail(mailserver, recipient, sender, subject, message)
%>
% If "" = result Then %>
恭喜,郵件發(fā)送成功!
% Else %>
抱歉,郵件發(fā)送失敗!
H2>
%= result %>
/H2>
% End If %> [1]