<%@ Import Namespace="System.Web.Mail" %>
<html>
<script language="C#" runat="server">
void Error_500(Object sender, EventArgs e) {
String foo = null;
Response.Write(foo.ToString());
}
void Page_Error(Object sender, EventArgs e) {
String message = "<font face=verdana color=red>"
+ "<h4>" + Request.Url.ToString() + "</h4>"
+ "<pre><font color='red'>" + Server.GetLastError().ToString() + "</pre>"
+ "</font>";
Response.Write(message);
Response.Write("此服务器上发生了错误,已通知该站点的管理员。");
MailMessage mail = new MailMessage();
mail.From = "hollo08@hotmail.com";
mail.To = "hollo08@126.com";
mail.Subject = "站点错误";
mail.Body = message;
mail.BodyFormat = MailFormat.Html;
SmtpMail.Send(mail);
Server.ClearError();
}
</script>
<body>
<form runat="server">
<h4><font face="宋体">导致发生错误...</font></h4>
<asp:button text="500 服务器错误" OnClick="Error_500" width="150" runat="server"/><p>
</form>
</body>
</html>
分享到:
相关推荐
C#编码,使用MailMessage对象发送邮件
Imports System.Runtime.InteropServices Imports System.Net.Mail.MailMessage Imports System.Net.Mail Public Class Form1 ......................................
[CLASS] org.apache.tools.ant.Main org.apache.tools.ant.Task org.apache.tools.bzip2.CRC org.apache.tools.ant.Target org.apache.tools.ant.Project org.apache.tools.zip.ZipFile org.apache.tools.zip...
C# 邮件发送类,MailMessage
3. * 发送邮件需要使用的基本信息 4. */ 5. import java.util.Properties; 6. public class MailSenderInfo { 7. // 发送邮件的服务器的IP和端口 8. private String mailServerHost; 9. private String ...
MailMessage MailParseException MailPreparationException MailSender MailSendException ManagedAttribute ManagedAttribute ManagedList ManagedMap ManagedNotification ManagedNotification ...
asp.net发送电子邮件例子: using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI....
MailMessage _mailMessage = new MailMessage(strFrom, to); _mailMessage.Subject = title;//主题 _mailMessage.Body = content;//内容 _mailMessage.BodyEncoding = System.Text.Encoding.UTF8;//正文编码 _...
利用MailMessage,MailAddress发送邮件
简单的邮件发送类,利用System.Web.Mail.MailMessage
用法与范例若要使用该库,请将S22.Mail.dll程序集添加到Visual Studio中的项目引用中。 SerializableMailMessage类实现转换运算符,以允许在SerializableMailMessage和MailMessage对象之间进行隐式转换。 using ...
基于 System.Web.Mail的邮件发送和接收类
C# 发送邮件 System.Web.Mail.MailMessage myEmail = new System.Web.Mail.MailMessage(); System.Web.Mail.SmtpMail.Send(myEmail);
邮件发送 方法一:使用System.Web.Mail命名空间(此方法我测试没有成功过) 代码如下:#region 发送邮件:此方法失败 protected void SendFailed() { System.Web.Mail.MailMessage mail = new System.Web.Mail....
smtpClient类:允许应用程序使用简单邮件传输协议 (SMTP) 发送电子邮件。 MailAddress类:MailAddress类表示电子邮件的地址。该类结合SmtpClient类或MailMessage类使用,其实例存储了电子邮件的地址信息。 ...
于是,我们会想到很多安全措施,比如使用SSL、建立网上银行一样的强认证方式等,但是,对于大部分网站而言,可能这些方法具有一定的困难性,因为要实现这些比较强的安全措施,最起码需要一台服务器,在经济上显然...
经过仔细研究才发现用.net发送电子邮件是很简单的一件事情.现在我们就来看一下. 首先添加命名空间 Using System.Net.Mail 下面我们看发送邮件的代码部分:(注意:网易的邮件服务器是 smtp.163.com) MailAddress from ...
Interop.jmail.dll,在使用c#和outlook发送邮件时,使用,作为MailMessage的命名空间。详细使用方法可以参考我的博客。
public partial class MailSender : Form { private string filenameok = ""; private string filenameno = ""; private MailMessage message; public MailSender() { InitializeComponent(); } private ...