Imports System.Net.Mail
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim To_Address As String = Me.TextBox1.Text '"oonedpiece@gmail.com"
' 設定SMTPserver
Dim SMTP_Server As New SmtpClient("smtp.anet.net.tw")
Dim Mailmsg As New System.Net.Mail.MailMessage
Dim MailBodyHtml As String
Mailmsg.IsBodyHtml = True ' 為html內容格式
' 此信的寄件人
Mailmsg.From = New Net.Mail.MailAddress("vincent@guidenet.com.tw", "寄件人")
Mailmsg.Subject = Me.TextBox2.Text '"主旨"
MailBodyHtml = Me.TextBox2.Text '"TEST TEST"
Mailmsg.Body = MailBodyHtml
' 將字串裡的;分為多個收件人
For Each toperson As String In To_Address.Split(CChar(";"))
Mailmsg.To.Add(New Net.Mail.MailAddress(toperson, "收件人"))
Next
SMTP_Server.Send(Mailmsg)
End Sub
沒有留言:
張貼留言