<!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>
<script src="https://www.jb51.net/Style/jquery/jquery.js" type="text/javascript"></script>
<script src="https://www.jb51.net/Style/jquery/jquery.validate.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
function gei() {
var file_value = document.getElementById("File1").value;
document.getElementById("HiddenField1").value = file_value;
}
</script>
</head>
<body>
<form runat="server">
<div>
发给:<asp:TextBox runat="server"></asp:TextBox><br />
抄送:<asp:TextBox runat="server"></asp:TextBox><br />
密送:<asp:TextBox runat="server"></asp:TextBox><br />
主题:<asp:TextBox runat="server"></asp:TextBox><br />
内容:<asp:TextBox runat="server"></asp:TextBox><br />
附件:<input type="file" />
<%--<asp:TextBox runat="server"></asp:TextBox>--%>
<br />
<asp:Button runat="server" Text="发送" OnClientClick="gei()" /><br />
<asp:Label runat="server" Text=""></asp:Label>
</div>
<asp:HiddenField runat="server" />
</form>
</body>
</html>
后台:
复制代码 代码如下:
protected void Button1_Click(object sender, EventArgs e)
{ //实例邮件帮助类
mailhelper mails = new mailhelper();
string filePath = HiddenField1.Value;
string a = mails.SendeEmal(TextBox1.Text, "邮件账号", "邮件密码", TextBox2.Text, TextBox4.Text, TextBox5.Text, filePath, TextBox3.Text);
Label1.Text = a;
}
您可能感兴趣的文章: