精华区 [关闭][返回]

当前位置:月光软件>>讨论区精华>>〖软件开发〗>>● ASP>>★ASP的延伸★>>ASP.NET>>如何在ASP+中发送邮件

主题:如何在ASP+中发送邮件
发信人: dongbao()
整理人: dongbao(2000-09-17 17:30:46), 站内信件
This article features how to send email from an ASP+ page.  Using email from
 an ASP+ page has many uses
(Notify of errors, inform people about a a subject. etc..).    This code sam
ple sends a formatted HTML
message to the email address entered.  Enjoy this free code!
Here is the code
Page 1.  The input form
<html>
<head>
</head>
<body>
<form method="post" name="form1" action="emailhtml2.aspx">
Email Address:<input type="text" name="EmailAddress" size="30" value="yourem
[email protected]"><br><br>
<input type="submit" value="Send Your Friend an Email using ASP+" name="b1">

</form>
</body>
</html>
Page 2.  Sends the email code
<%@ Import Namespace="System.Web.Util" %>
<script language="VB" runat=server>
Sub Page_load(Sender as Object, E as EventArgs)
Dim MyMessage as New MailMessage
MyMessage.To = request.form("EmailAddress")
MyMessage.From = "webmaster"
MyMessage.Subject = "This is message is from ASPFree using ASP+"
Note:We added the BodyFormat to show how to send
formatted HTML remove this line and all the HTML code in
message. The email will send as regular text
MyMessage.BodyFormat = MailFormat.Html
MyMessage.Body = "<html><body><h1>You received this email from href='http://aspfree.com'>ASPFree.com using ASP+!</h1></body></html>"
SmtpMail.Send(MyMessage)
End Sub
</script>
<html>
<head>
<title>Email Formatted HTML message with ASP+</title>
</head>
<body>
You just sent an email message formatted in HTML to:<br>
<h1><% response.write(request.form("EmailAddress")) %></h1>
</body>
</html>


--
ICQ:43395237 OICQ:126132  
我自豪我用正版,我骄傲我用盗版!!! 





※ 来源:.Netease BBS(BJ) bj.163.com.[FROM: 202.108.0.66]

[关闭][返回]






转载请注明:转载自 月光程序代码网 [ http://www.moon-soft.com ]