富贵资源网 Design By www.hznty.com
1、Default.aspx代码如下:
复制代码 代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" ValidateRequest="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table id="TABLE1" runat="server" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 393px">
收信:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
主题:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
内容:<asp:TextBox ID="TextBox3" runat="server" Height="154px" TextMode="MultiLine"
Width="336px"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" Text="发送" OnClick="Button1_Click" /></td>
</tr>
</table>
</div>
<table id="Table2" runat="server" border="0" cellpadding="0" cellspacing="0" visible="false">
<tr>
<td align="center" style="width: 400px">
<asp:Label ID="Label1" runat="server" ForeColor="Red" Text="恭喜您,发表成功!"></asp:Label><br />
<asp:Button ID="Button2" runat="server" Text="返回" OnClick="Button2_Click" /></td>
</tr>
</table>
</form>
</body>
</html>
2、Default.aspx.cs代码如下:
复制代码 代码如下:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//倒入命名空间
using System.Net;
using System.Net.Mail;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
////设置发件人信箱,及显示名字
MailAddress from = new MailAddress("zgdx0503@cpp114.com", "延边职大信息中心");
//设置收件人信箱,及显示名字
MailAddress to = new MailAddress(TextBox1.Text, "0503班");
//创建一个MailMessage对象
MailMessage oMail = new MailMessage(from, to);
oMail.Subject = TextBox2.Text; //邮件标题
oMail.Body = TextBox3.Text; //邮件内容
oMail.IsBodyHtml = true; //指定邮件格式,支持HTML格式
oMail.BodyEncoding = System.Text.Encoding.GetEncoding("GB2312");//邮件采用的编码
oMail.Priority = MailPriority.High;//设置邮件的优先级为高
//发送邮件服务器
SmtpClient client = new SmtpClient();
client.Host = "mail.cpp114.com"; //指定邮件服务器
client.Credentials = new NetworkCredential("zgdx0503@cpp114.com", "123456");//指定服务器邮件,及密码
//发送
try
{
client.Send(oMail); //发送邮件
Label1.Text = "恭喜你!邮件发送成功。";
}
catch
{
Label1.Text = "邮件发送失败,检查网络及信箱是否可用。";
}
oMail.Dispose(); //释放资源
TABLE1.Visible = false;
Table2.Visible = true;
}
protected void Button2_Click(object sender, EventArgs e)
{
//返回,继续发送
Response.Redirect(Request.Url.ToString());
TABLE1.Visible = true;
Table2.Visible = false;
}
}
3、运行并输入测试信箱zgdx0503@tom.com,(密码:123456)。如下所示:
4、打开信箱查看
复制代码 代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" ValidateRequest="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table id="TABLE1" runat="server" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 393px">
收信:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
主题:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
内容:<asp:TextBox ID="TextBox3" runat="server" Height="154px" TextMode="MultiLine"
Width="336px"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" Text="发送" OnClick="Button1_Click" /></td>
</tr>
</table>
</div>
<table id="Table2" runat="server" border="0" cellpadding="0" cellspacing="0" visible="false">
<tr>
<td align="center" style="width: 400px">
<asp:Label ID="Label1" runat="server" ForeColor="Red" Text="恭喜您,发表成功!"></asp:Label><br />
<asp:Button ID="Button2" runat="server" Text="返回" OnClick="Button2_Click" /></td>
</tr>
</table>
</form>
</body>
</html>
2、Default.aspx.cs代码如下:
复制代码 代码如下:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//倒入命名空间
using System.Net;
using System.Net.Mail;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
////设置发件人信箱,及显示名字
MailAddress from = new MailAddress("zgdx0503@cpp114.com", "延边职大信息中心");
//设置收件人信箱,及显示名字
MailAddress to = new MailAddress(TextBox1.Text, "0503班");
//创建一个MailMessage对象
MailMessage oMail = new MailMessage(from, to);
oMail.Subject = TextBox2.Text; //邮件标题
oMail.Body = TextBox3.Text; //邮件内容
oMail.IsBodyHtml = true; //指定邮件格式,支持HTML格式
oMail.BodyEncoding = System.Text.Encoding.GetEncoding("GB2312");//邮件采用的编码
oMail.Priority = MailPriority.High;//设置邮件的优先级为高
//发送邮件服务器
SmtpClient client = new SmtpClient();
client.Host = "mail.cpp114.com"; //指定邮件服务器
client.Credentials = new NetworkCredential("zgdx0503@cpp114.com", "123456");//指定服务器邮件,及密码
//发送
try
{
client.Send(oMail); //发送邮件
Label1.Text = "恭喜你!邮件发送成功。";
}
catch
{
Label1.Text = "邮件发送失败,检查网络及信箱是否可用。";
}
oMail.Dispose(); //释放资源
TABLE1.Visible = false;
Table2.Visible = true;
}
protected void Button2_Click(object sender, EventArgs e)
{
//返回,继续发送
Response.Redirect(Request.Url.ToString());
TABLE1.Visible = true;
Table2.Visible = false;
}
}
3、运行并输入测试信箱zgdx0503@tom.com,(密码:123456)。如下所示:
4、打开信箱查看
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com
暂无评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?