| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 416 人关注过本帖
标题:[求助]邮件为何发送不出去
只看楼主 加入收藏
adu520
Rank: 1
等 级:新手上路
帖 子:28
专家分:0
注 册:2006-5-6
收藏
 问题点数:0 回复次数:0 
[求助]邮件为何发送不出去

怎么发不出去呢
????
请高手指点
是不是还少点啥



Imports System.Web.Mail
Imports System.IO
Imports System.Web
Imports System
Imports System.Web.Util

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web 窗体设计器生成的代码 "

'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents label2 As System.Web.UI.WebControls.Label
Protected WithEvents label3 As System.Web.UI.WebControls.Label
Protected WithEvents label4 As System.Web.UI.WebControls.Label
Protected WithEvents label5 As System.Web.UI.WebControls.Label
Protected WithEvents label6 As System.Web.UI.WebControls.Label
Protected WithEvents txtshou As System.Web.UI.WebControls.TextBox
Protected WithEvents fname As System.Web.UI.WebControls.TextBox
Protected WithEvents txtsub As System.Web.UI.WebControls.TextBox
Protected WithEvents femail As System.Web.UI.WebControls.TextBox
Protected WithEvents txtemail As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Label7 As System.Web.UI.WebControls.Label
Protected WithEvents Label8 As System.Web.UI.WebControls.Label
Protected WithEvents fj As System.Web.UI.WebControls.DropDownList
Protected WithEvents upfile As System.Web.UI.HtmlControls.HtmlInputFile
Protected WithEvents upload As System.Web.UI.WebControls.Button
Protected WithEvents delfile As System.Web.UI.WebControls.Button
Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
Protected WithEvents RegularExpressionValidator1 As System.Web.UI.WebControls.RegularExpressionValidator
Protected WithEvents RegularExpressionValidator2 As System.Web.UI.WebControls.RegularExpressionValidator
Protected WithEvents RequiredFieldValidator1 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents RequiredFieldValidator2 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents RequiredFieldValidator3 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents Label9 As System.Web.UI.WebControls.Label

'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mymessage As New MailMessage
Dim i As Integer
Dim attchments(fj.Items.Count) As String
Dim attchfile As MailAttachment

mymessage.From = femail.Text
mymessage.To = txtshou.Text
mymessage.Subject = txtsub.Text
mymessage.Body = txtemail.Text
mymessage.BodyFormat = MailFormat.Html
attchfile = New MailAttachment(upfile.PostedFile.FileName)
mymessage.Attachments.Add(attchfile)

For i = 0 To fj.Items.Count - 1
attchments(i) = fj.Items(i).Value

Next


SmtpMail.SmtpServer = "smtp.163.com"

SmtpMail.Send(mymessage)

Label7.Text = "你的信件已经成功的发送到了" + txtshou.Text
Page.RegisterClientScriptBlock("ok", "<script language=javascript>alert('发送成功')</script>")

End Sub

Private Sub upload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles upload.Click

If upfile.PostedFile.ContentLength <> 0 Then
Label7.Text = upfile.PostedFile.FileName
delfile.Visible = True
fj.Visible = True
fj.Items.Add(upfile.PostedFile.FileName)
End If
Page.RegisterClientScriptBlock("ok", "<script language=javascript>alert('上传成功')</script>")

End Sub
End Class


搜索更多相关主题的帖子: 邮件 
2006-05-12 02:54
快速回复:[求助]邮件为何发送不出去
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026312 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved