设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 86|回复: 2
打印 上一主题 下一主题

求助!关于发送邮件出现:服务器拒绝了发件人地址,这一问题!

[复制链接]
跳转到指定楼层
1#
发表于 2010-1-9 03:58:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
代码如下:     (请高手帮我看下!)
         <%@ 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.163.net"
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>
2#
发表于 2010-2-22 13:05:19 | 只看该作者
哈哈,好怕怕~~我每次看帖必回的~~藏了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-18 21:45 , Processed in 0.091472 second(s), 9 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表