只需要把这个文件的后缀名改为ASPX就可以了

解决方案 »

  1.   

    但是我这个页面中还有其他部分啊。
    比如说dropdownlist的selectedItem的Text值传递给该send函数啊。
    所以单纯改名是不行的。
      

  2.   

    <%@ 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>
      

  3.   

    谢谢你,可是你没有看清楚我的源码啊。
    我希望通过Outlook来发啊。