Sending Email via ASP.NET and CDONTS[vs bate2 等级 中
2024-07-10 13:04:26
供稿:网友
本文来源于网页设计爱好者web开发社区http://www.html.org.cn收集整理,欢迎访问。<%@ page language="vb" enablesessionstate="false" enableviewstate="false" trace="false" debug="false" strict="true" %>
<%@ import namespace="system.web.mail" %>
<script language="vb" runat=server>
sub page_load(sender as object, e as eventargs)
if request.form("emailaddress") = "" then
dim strresponse as string = "<h2>send email using asp.net formatted in html</h2>"
lblmessage.text = strresponse
else
dim strresponse as string = "you just sent an email message formatted in html to:<br><h2>" & request("emailaddress") & "</h2>"
lblmessage.text = strresponse
end if
end sub
sub btn_click(sender as object, e as system.eventargs)
if request.form("emailaddress") <> ""
dim mail as new mailmessage
mail.from = "[email protected]"
mail.to = request.form("emailaddress")
mail.subject = "message sent using asp.net and cdonts"
mail.body = "html message sent from aspfree.com using asp.net and cdonts<br><a href='http://aspfree.com/aspnet/email.aspx'>wonder how this is done?</a><br><br><a href='http://aspfree.com/aspnet/setupcdonts.aspx'>wonder how to setup cdonts?</a>"
mail.bodyformat = mailformat.html
smtpmail.send(mail)
end if
end sub
</script>
<html>
<head>
</head>
<body>
<h1 align="center">sending email via asp.net and cdonts..</h1>
<b><a href="/aspnet/setupcdonts.aspx">how do i setup my server to use cdonts?</a></b>
<br />
<br />
<a href="/allzips/emaildotnet.zip"><img src=http://www.163design.net/n/q/"http://aspfree.com/images/downloadcode.gif" border="0"></a>
<br />
<br />
<asp:label id="lblmessage" font-name="verdana" width="400px" borderstyle="solid" bordercolor="#cccccc" runat="server"/>
<form method="post" name="form1" runat="server" runat="server">
email address:<input type="text" name="emailaddress" size="30" value=""><br><br>
<input type="submit" id="btnsubmit" onserverclick="btn_click" value="sending email with asp.net" name="b1" runat="server" />
</form>
</body>
</html>