[求助]为什么邮件只能发往163邮箱
只能发往163邮箱,往sohu发就不行了!!各位高手帮我看看是怎么回事!!<%@ import namespace="system.web.mail" %>
<script language="vb" runat="server">
sub sendmsg(sender as object, e as imageclickeventargs)
dim objmail as new mailmessage()
objmail.from=fromwho.text & "<" & frommail.text & ">"
objmail.to=towho.text & "<" & tomail.text & ">"
select case bodyformat.selecteditem.text
case "html"
objmail.bodyformat=mailformat.html
case "text"
objmail.bodyformat=mailformat.text
end select
select case bodyencoding.selecteditem.text
case "UTF8"
objmail.bodyencoding=encoding.UTF8
case "UTF7"
objmail.bodyencoding=encoding.UTF7
case "ASCII"
objmail.bodyencoding=encoding.ASCII
case "unicode"
objmail.bodyencoding=encoding.unicode
end select
objmail.subject=subject.text
objmail.body=content.text
if filename.value<>"" then
dim attachfile as mailattachment
attachfile=new mailattachment(filename.postedfile.filename)
objmail.attachments.add(attachfile)
end if
smtpmail.smtpserver="smtp.163.com"
dim SendUserName as string="×××××@163.com"
dim SendPassword as string="×××××××××"
objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",1)
objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", SendUserName)
objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", SendPassword)
smtpmail.send(objmail)
end sub
sub resetmsg(sender as object, e as imageclickeventargs)
fromwho.text=""
frommail.text=""
towho.text=""
tomail.text=""
subject.text=""
content.text=""
end sub
</script>
<html>
<head>
<title>邮件发送</title>
</head>
<body>
<center><asp:image runat="server" imageurl="title.jpg" /></center>
<form runat="server">
<table width=80% align="center" cellspacing=0 cellpadding=3>
<tr bgcolor="#ffffa1">
<td width=17%>发件人</td>
<td width=25%>
<asp:textbox runat="server" id="fromwho" columns=7 />
</td>
<td colspan=2 width=58%>电子邮箱
<asp:textbox runat="server" id="frommail" columns=20 /><br>
</td>
</tr>
<tr bgcolor="#fffff0">
<td>收件人</td>
<td><asp:textbox runat="server" id="towho" columns=7 /></td>
<td colspan=2>电子邮箱
<asp:textbox runat="server" id="tomail" columns=20 />
</td>
</tr>
<tr bgcolor="#ffffa1">
<td>邮件格式</td>
<td>
<asp:radiobuttonlist runat="server" id="bodyformat" repeatcolumns=2>
<asp:listitem text="html" value="html" selected="true" />
<asp:listitem text="text" value="text" />
</asp:radiobuttonlist>
</td>
<td>编码方式</td>
<td>
<asp:radiobuttonlist runat="server" id="bodyencoding" repeatcolumns=4>
<asp:listitem text="UTF8" value="UTF8" selected="true" />
<asp:listitem text="UTF7" value="UTF7" />
<asp:listitem text="ASCII" value="ASCII" />
<asp:listitem text="Unicode" value="Unicode"/>
</asp:radiobuttonlist>
</td>
</tr>
<tr bgcolor="#ffffa1">
<td>邮件主题</td>
<td colspan=3>
<asp:textbox runat="server" id="subject" columns=55 />
</td>
</tr>
<tr bgcolor="#fffff0">
<td>邮件内容</td>
<td colspan=3>
<asp:textbox runat="server" id="content" textmode="multiline" columns=45 rows=5 />
</td>
</tr>
<tr bgcolor="#ffffa1">
<td width=18%>附件</td>
<td colspan=3>
<input type="file" runat="server" id="filename" size=50 />
</td>
</tr>
</table>
<center>
<asp:imagebutton runat="server" imageurl="send.gif" onclick="sendmsg" />
<asp:imagebutton runat="server" imageurl="reset.gif" onclick="resetmsg" />
</center>
<asp:requiredfieldvalidator runat="server" controltovalidate="fromwho" errormessage="发件人" display="none" />
<asp:requiredfieldvalidator runat="server" controltovalidate="frommail" errormessage="发件人电子信箱" display="none" />
<asp:requiredfieldvalidator runat="server" controltovalidate="towho" errormessage="收件人" display="none" />
<asp:requiredfieldvalidator runat="server" controltovalidate="tomail" errormessage="收件人电子信箱" display="none" />
<asp:requiredfieldvalidator runat="server" controltovalidate="subject" errormessage="主题" display="none" />
<asp:requiredfieldvalidator runat="server" controltovalidate="content" errormessage="内容" display="none" />
<asp:validationsummary runat="server" displaymode="bulletlist" showmessagebox="true" showsummary="false" headertext="错误警告,以下字段不可为空:" />
</form>
</body>
</html>