formToEmail.htm
' 表單.
<FORM METHOD="POST" ACTION="formToEmail.asp">
<P>
收件人: <INPUT SIZE=30 NAME="recipient" MAXLENGTH=200>
<P>
發件人: <INPUT SIZE=30 NAME="sender" MAXLENGTH=200>
<P>
主題: <INPUT SIZE=30 NAME="subject" MAXLENGTH=512>
<P>
內容一: <TEXTAREA ROWS=2 COLS=60 NAME="messageline1"> </TEXTAREA>
<P>
內容二: <TEXTAREA ROWS=2 COLS=60 NAME="messageline2"> </TEXTAREA>
</PRE>
<INPUT TYPE=submit VALUE="發送">
formToEmail.asp
' 處理接收和發送郵件.
<%
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 %>
恭喜,郵件發送成功!
<% Else %>
抱歉,郵件發送失敗!
[1]