1
我已經知道如何使用vb.net發送電子郵件,但是我無法弄清楚如何接收電子郵件。我想進入我的電子郵件帳戶並閱讀電子郵件並將其存儲在變量中,這可能嗎?如果是的話,任何人都可以給我一些示例代碼,因爲那樣會很棒。VB.net接收電子郵件
只是爲了得到我使用的是這裏什麼是我發送電子郵件的代碼是一個好主意,
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.Credentials = New _
Net.NetworkCredential("[email protected]", "qwerty1205")
SmtpServer.Port = 587
SmtpServer.Host = "smtp.gmail.com"
mail = New MailMessage()
mail.From = New MailAddress("[email protected]")
mail.To.Add("[email protected]")
mail.Subject = "Alarm"
mail.Body = "Some one is in your room"
SmtpServer.Send(mail)
MsgBox("mail send")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub