asp.net2.0实现邮件发送(测试成功)

2019-05-12 08:30:02刘景俊
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 />