- 最後登錄
- 2023-4-24
- 在線時間
- 186 小時
- 註冊時間
- 2008-4-1
- 閱讀權限
- 20
- 精華
- 0
- UID
- 3887184
- 帖子
- 372
- 積分
- 21 點
- 潛水值
- 5911 米
| 回覆中加入附件並不會使你增加積分,請使用主題方式發佈附件。 網路上找的,試一下吧!- Imports System.Net.Mail
- Public Class Form1
- 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("username@gmail.com", "password")
- SmtpServer.Port = 587
- SmtpServer.Host = "smtp.gmail.com"
- mail = New MailMessage()
- mail.From = New MailAddress("YOURusername@gmail.com")
- mail.To.Add("TOADDRESS")
- mail.Subject = "Test Mail"
- mail.Body = "This is for testing SMTP mail from GMAIL"
- SmtpServer.Send(mail)
- MsgBox("mail send")
- Catch ex As Exception
- MsgBox(ex.ToString)
- End Try
- End Sub
- End Class
複製代碼 ... |
|