打印本文 打印本文  关闭窗口 关闭窗口  
如何使用AspEmail
作者:未知  文章来源:本站原创  点击数  更新时间:2006/4/22 10:38:11  文章录入:admin  责任编辑:admin


<%
' 改成您自己的 SMTP server
strHost = "cidu.net"

If Request("Send") <> "" Then

Set Mail = Server.CreateObject("Persits.MailSender")
' enter valid SMTP host
Mail.Host = strHost


Mail.From = Request("From") ' From address
Mail.FromName = Request("FromName") ' optional
Mail.AddAddress Request("To")

' message subject
Mail.Subject = Request("Subject")

Mail.Charset = "gb2312"

' message body
'Mail.Body = Request("Body")
Mail.Body = "你好!" & chr(10) & " 具体内容"


strErr = ""
bSuccess = False
On Error Resume Next ' catch errors

Mail.Username = "user@cidu.net"
Mail.Password = "********"

Mail.Send ' send message
If Err <> 0 Then ' error occurred
strErr = Err.Description
else
bSuccess = True
End If
End If
%>


<HTML>
<HEAD>
<TITLE>AspEmail: Simple.asp</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">


<H2>AspEmail: Simple.asp</h2><br>
<br>
<% If strErr <> "" Then %>
<h3><FONT COLOR="#FF0000">Error occurred: <I><% = strErr %></I></FONT></h3>
<% End If %>


<% If bSuccess Then %>
<h3><FONT COLOR="#00A000">Success! Message sent to <% = Request("To") %>.</FONT></h3>
<% End If %>


<FORM METHOD="POST" ACTION="Simple.asp">


<TABLE CELLSPACING=0 CELLPADDING=2 BGCOLOR="#E0E0E0" height="183" border="1" style="border-collapse: collapse" bordercolor="#111111">
<TR>
<TD height="16"><b>邮件主机</b> (根据实际情况进行修改):</TD>
<TD height="16"><B><% = strHost %></B></TD>
</TR>
<TR>
<TD height="19">发件人邮件地址:</TD>
<TD height="19"><INPUT TYPE="TEXT" NAME="From" size="20"></TD>
</TR>
<TR>
<TD height="19">发件人名字 (可选):</TD>
<TD height="19"><INPUT TYPE="TEXT" NAME="FromName" size="20"></TD>
</TR>
<TR>
<TD height="19">收件人地址:</TD>
<TD height="19"><INPUT TYPE="TEXT" NAME="To" size="20"></TD>
</TR>
<TR>
<TD height="19">主题:</TD>
<TD height="19"><INPUT TYPE="TEXT" NAME="Subject" size="20"></TD>
</TR>
<TR>
<TD height="42">内容:</TD>
<TD height="42"><TEXTAREA NAME="Body" rows="4" cols="20"></TEXTAREA></TD>
</TR>
<TR>
<TD COLSPAN=2 height="21"><INPUT TYPE="SUBMIT" NAME="Send" VALUE="Send Message"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>

 

打印本文 打印本文  关闭窗口 关闭窗口