问什么我编写的程序不能够发送163 的邮件 代码如下
该功能是在我电脑上面不用登陆我的邮箱就可以发邮件,可是程序运行后总是显示,邮箱不可用!麻烦高手给我看看,是代码的问题,还是网易邮箱不支持验证Imports System.Net.Mail
Public Class mail
Private sendmail As New System.Net.Mail.MailMessage
Private Sub btnfujian_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfujian.Click
Dim ofd As New OpenFileDialog
ofd.CheckFileExists = True
ofd.Title = "please choose files"
ofd.Multiselect = True
If ofd.ShowDialog(Me) Then
For i As Integer = 0 To ofd.FileNames.Length - 1
sendmail.Attachments.Add(New System.Net.Mail.Attachment(ofd.FileNames(i)))
Me.txtfile.Text &= ofd.FileNames(i) & vbCrLf
Next
End If
End Sub
Private Sub btnsend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsend.Click
If sendmail Is Nothing Then Exit Sub
sendmail.From = New MailAddress("liuyufengk@163.com", "liuyufengk")
sendmail.To.Add(Me.txtmailto.Text)
sendmail.Subject = Me.txttitle.Text()
sendmail.Body = Me.txtContent.Text
sendmail.Priority = MailPriority.High
Dim SMTP As New SmtpClient("smtp.163.com")
SMTP.Credentials = New Net.NetworkCredential("liuyufengk@163.com", "密码")
Try
SMTP.Send(sendmail)
MessageBox.Show("邮件已发送成功!", "邮件发送成功", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
Catch ex As Exception
MessageBox.Show(ex.Message, "邮件发送失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
End Try
End Sub
End Class
--------------------编程问答-------------------- 学习~学smtp的时候不能上网,就借此理由没听课--! --------------------编程问答-------------------- 邮箱有的有STMP验证,新注册的邮箱甚至干脆不支持SMTP的 --------------------编程问答-------------------- 我的不是新的邮箱!都用了好久!该程序运行的时候错误提示为邮箱不可用!
补充:.NET技术 , VB.NET