日期:2014-05-17  浏览次数:20494 次

ASP.Net 发送电子邮件并添加附件
在网上参考了一些资料,或多或少有些问题,老是提示用法已过时,最无奈的是我的input的ID在VS不能通过VS的代码补全功能显示出来,请大家指教,附上部分代码如下:
E-mail.aspx
[code=HTML][/code]<table style="left: 196px; position: relative; top: 0px">
  <tr>
  <td colspan="2"; style="width:800px;height:30px; background-color:#99ffff; text-align:center; font-family:隶书;">发送电子邮件</td>
  </tr>
  <tr>
  <td style="width:80px;height:30px;">
  收件人:</td>
  <td style="width:720px;height:30px;">
  <asp:TextBox ID="geter" runat="server" Style="position: relative;width:715px;height:28px;"></asp:TextBox></td>
  </tr>
  <tr>
  <td style="width:80px;height:30px;">
  发件人:</td>
  <td style="width:720px;height:30px;">
  <asp:TextBox ID="senter" runat="server" Style="position: relative;width:715px;height:28px;"></asp:TextBox></td>
  </tr>
  <tr>
  <td style="width:80px;height:30px;">
  附 件:</td>
  <td style="width:720px;height:30px;">
<input id="File1" style="position: relative" type="file" name="file1"/></td> (为什么代码补全能不能显示File1,而其他的如senter,geter都可以在提示中找到???) </tr>
  <tr>
  <td style="width:80px;height:30px;">
  主 题:</td>
  <td style="width:720px;height:30px;">
  <asp:TextBox ID="TalkTitle" runat="server" Style="position: relative;width:715px;height:28px;"></asp:TextBox></td>
  </tr>
  <tr>
  <td style="width:80px;height:350px;">
  正 文:</td>
  <td style="width:720px;height:350px;">
  <asp:TextBox ID="TalkBody" runat="server" Style="position: relative;width:715px;height:348px;" TextMode="MultiLine"></asp:TextBox></td>
  </tr>
  <tr>
  <td style="width:800px;height:30px;" colspan="2">
  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  <asp:Button ID="SendButton" runat="server" Style="position: relative" Text="发送" OnClick="SendButton_Click" /></td>
  </tr>
  </table>

E-mail.aspx.cs
protected void SendButton_Click(object sender, EventArgs e)
  {
  MailMe