求助!关于发送邮件出现:服务器拒绝了发件人地址,这一问题!
代码如下: (请高手帮我看下!)<%@ Page Language="VB" %>
<%@ import Namespace="System.Web.Mail"%>
<script language="vb" runat="server">
sub Button_Click(sender As object,e As EventArgs)
dim mail as MailMessage = New MailMessage()
mail.To=mailTo.text
mail.From=mailFrom.text
mail.subject=mailsubject.text
mail.Body=mailBody.text
if Format.Selecteditem.text="纯文本格式" then
mail.BodyFormat=mailFormat.text
else
mail.BodyFormat=mailFormat.Html
end if
dim File as HttpPostedFile=FileUp.postedFile
if file.ContentLength<>0 then
dim FileSplit() as string=Split(File.FileName,"\")
dim Filename as string=fileSplit(fileSplit.length-1)
file.SaveAs(Server.MapPath(FileName))
dim attach As New MailAttachment(Server.MapPath(FileName))
mail.attachments.add(attach)
end if
On error Resume Next
smtpmail.smtpserver="pop3.
smtpmail.send(mail)
if err.number<>0 then
msg.text=err.Description
else
msg.text="邮件已经送出!"
end if
end sub
</script>
<html>
<head>
<title>发送邮件</title>
<style type="text/css">
<!--
.style1 {
font-size: 36px;
color: #00FF00;
font-family: "华文隶书";
}
-->
</style>
</head>
<body bgcolor="white">
<h2 align="center" class="style1">发送电子邮件! </h2>
<h2>
<hr>
</h2>
<form runat="server">
<table border="0">
<tr>
<td>收件人:</td>
<td><asp:TextBox ID="mailto" size=40 runat="server"/></td>
</tr>
<tr>
<td>寄件人:</td>
<td><asp:TextBox ID="mailFrom" size=40 runat="server"/></td>
</tr>
<tr>
<td>主题:</td>
<td><asp:TextBox ID="mailsubject" size=40 runat="server"/></td>
</tr>
<tr>
<td>正文:</td>
<td><asp:TextBox ID="mailbody" size=40 TextMode="MultiLine" Rows="20" Columns="60" runat="server"/>
<br><asp:RadioButtonList ID="Format" runat="server" RepeatDirection="Horizontal" RepeatColumns="2">
<asp:ListItem Selected>Html 格式</asp:ListItem>
<asp:ListItem>纯文本格式</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td>附件:</td>
<td><input type="file" ID="fileUp" runat="server"/></td>
</tr>
</table>
<asp:Button runat="server" Text="送出" OnClick="Button_Click"/>
<asp:Label ID="Msg" runat="server" ForeColor="red"/><p></p>
</form>
</body>
</html>