<%@ Import Namespace="System.Web.Mail"%> <%@ Page Language="VB" %> <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) Dim myMail As New System.Net.Mail.MailMessage() Dim Cred As New System.Net.NetworkCredential("[email protected]", "password") myMail.To.Add("[email protected]") myMail.Subject = "Test send mail message" myMail.From = New System.Net.Mail.MailAddress("[email protected]") myMail.IsBodyHtml = True myMail.Body = "Hi Sawatdee.<br><br>Sabye dee mai." Dim SmtpMail As New System.Net.Mail.SmtpClient("smtp.gmail.com") SmtpMail.UseDefaultCredentials = False SmtpMail.EnableSsl = True SmtpMail.Credentials = Cred SmtpMail.Port = 465 SmtpMail.Send(myMail) myMail = Nothing Me.lblText.Text = "Mail Sending." End Sub </script> <html> <head> <title>ThaiCreate.Com Tutorial</title> </head> <body> <form id="form1" runat="server"> <asp:Label id="lblText" runat="server"></asp:Label> </form> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท