If Page.IsPostBack = True Then
Try
Dim Smtp_Server As New SmtpClient
Dim e_mail As New MailMessage()
Smtp_Server.UseDefaultCredentials = False
Smtp_Server.Credentials = New Net.NetworkCredential("[email protected]", "password")
Smtp_Server.Port = 587
Smtp_Server.EnableSsl = True
Smtp_Server.Host = "smtp.gmail.com"
e_mail = New MailMessage()
e_mail.From = New MailAddress("[email protected]", "[email protected]")
e_mail.To.Add(last_to.Text.Trim)
e_mail.Bcc.Add(bccto.Text.Trim)
e_mail.Subject = subject_cus_name_textbox.Text
e_mail.IsBodyHtml = True
e_mail.Body = TextbodyBox.Text
Smtp_Server.Send(e_mail)
mailsent.Text = "ส่ง Mail แล้ว"
Catch error_t As Exception
mailsent.Text = error_t.message & " Error Mail"
End Try
End If
Tag : ASP, VBScript, Web (ASP.NET), VB.NET, VS 2010 (.NET 4.x), Windows