请问以下ASP代码在ASP.net中如何实现 只需要把这个文件的后缀名改为ASPX就可以了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 但是我这个页面中还有其他部分啊。比如说dropdownlist的selectedItem的Text值传递给该send函数啊。所以单纯改名是不行的。 <%@ Import NameSpace=" System.Web.Util " %><html><head> <Script Language="VB" runat=server> Sub Button1_Click(Sender As Object , e As EventArgs) Dim mail As New MailMessage Dim smtp As New SmtpMail If mailTo.Text <> "" Then mail.To=mailTo.Text mail.From=mailFrom.Text mail.Subject=mailSubject.Text mail.Priority=mailPriority.High If UCase(format.SelectedItem.value) = "TEXT" Then mail.BodyFormat= MailFormat.Text Else mail.BodyFormat = MailFormat.Html End If If AttachFile.value <> "" Then mail.Attachments.add(New Mailattachment(AttachFile.value)) End If mail.Body= mailBody.Text Smtp.Send(mail) Label.Text = "信件已经发送出去!" End If </Script></head><Body><h3><font face="Verdana" >MailMessage 及SmtpMail 控件</font></h3> <asp:Label Style="color:red" id="Label" runat=server /> <Form runat=server> <Table style="Border:soled#6699cc" CellSpacing=0 CellPadding=3> <Tr><Td>收信人:</Td><Td><asp:TextBox id= "mailTo" Size=40 runat=server />(*@mailserver)</Td></Tr> <Tr><Td>寄信人:</Td><Td><asp:TextBox id= "mailFrom" Size=40 runat=server />(*@mailserver)</Td></Tr> <Tr><Td>主题:</Td><Td><asp:TextBox id= "mailSubject" Size=20 runat=server /></Td></Tr> <Tr><Td>正文:</Td><Td><asp:TextBox id= "mailBody" TextMode=MultiLine Row=5 Cols=40 runat=server /></Td></Tr> <Tr><Td>格式:</Td><Td><asp:RadioButtonList id="format" runat=server repeatDirection="Horizontal"> <asp:ListItem Selected value=Text Text="纯文本" /> <asp:ListItem value=Html Text="HTML格式" /> </asp:RadioButtonList></Td></Tr> <Tr><Td>附件:</Td><Td><Input Type=File id="AttachFile" runat=server /></Td></Tr> <Tr><Td colspan=2><hr><asp:Button Text="送出邮件" id="Button1" onClick="Button1_Click" runat=server /></Td></Tr> </Table> </Form></body></html> 谢谢你,可是你没有看清楚我的源码啊。我希望通过Outlook来发啊。 sql如何添加数据? 脚本高手来 我自己用.net+sqlserver做了一个网站,想挂在网上去 asp.net数据排序问题,(不是那种按照关键字排序!) 如何在asp.net中使用unicode? 防止后退??????????????? mysql中文字显示乱码 在一页面上,怎样使按下Enter键而不触发按钮点击??? 这个函数好不好?我全站都要用这个,效率怎么样?大哥大姐有空来看一下, 用asp.net作聊天室,如何下手? 在web用户控件中(ascx),如何为里面的dropdownlist控件作客户端的javascript事件呀? 如何定义一个Session数祖啊?
比如说dropdownlist的selectedItem的Text值传递给该send函数啊。
所以单纯改名是不行的。
<html>
<head>
<Script Language="VB" runat=server>
Sub Button1_Click(Sender As Object , e As EventArgs)
Dim mail As New MailMessage
Dim smtp As New SmtpMail
If mailTo.Text <> "" Then
mail.To=mailTo.Text
mail.From=mailFrom.Text
mail.Subject=mailSubject.Text
mail.Priority=mailPriority.High
If UCase(format.SelectedItem.value) = "TEXT" Then
mail.BodyFormat= MailFormat.Text
Else
mail.BodyFormat = MailFormat.Html
End If
If AttachFile.value <> "" Then
mail.Attachments.add(New Mailattachment(AttachFile.value))
End If
mail.Body= mailBody.Text
Smtp.Send(mail)
Label.Text = "信件已经发送出去!"
End If
</Script>
</head>
<Body><h3><font face="Verdana" >MailMessage 及SmtpMail 控件</font></h3>
<asp:Label Style="color:red" id="Label" runat=server />
<Form runat=server>
<Table style="Border:soled#6699cc" CellSpacing=0 CellPadding=3>
<Tr><Td>收信人:</Td><Td><asp:TextBox id= "mailTo" Size=40 runat=server />(*@mailserver)</Td></Tr>
<Tr><Td>寄信人:</Td><Td><asp:TextBox id= "mailFrom" Size=40 runat=server />(*@mailserver)</Td></Tr>
<Tr><Td>主题:</Td><Td><asp:TextBox id= "mailSubject" Size=20 runat=server /></Td></Tr>
<Tr><Td>正文:</Td><Td><asp:TextBox id= "mailBody" TextMode=MultiLine Row=5 Cols=40 runat=server /></Td></Tr>
<Tr><Td>格式:</Td><Td><asp:RadioButtonList id="format" runat=server repeatDirection="Horizontal">
<asp:ListItem Selected value=Text Text="纯文本" />
<asp:ListItem value=Html Text="HTML格式" />
</asp:RadioButtonList></Td></Tr>
<Tr><Td>附件:</Td><Td><Input Type=File id="AttachFile" runat=server /></Td></Tr>
<Tr><Td colspan=2><hr><asp:Button Text="送出邮件" id="Button1" onClick="Button1_Click" runat=server /></Td></Tr>
</Table>
</Form>
</body>
</html>
我希望通过Outlook来发啊。