แจ้ง
An exception of type 'System.Net.Mail.SmtpException' occurred in System.dll but was not handled in user code
Additional information: Failure sending mail.
ป๋มต้องแก้ตรงใหนป่าวครับ
รบกวนผู้รู้หน่อยครับ
ขอบคุณล่วงหน้าครับ
ตัวโค้ด
Code (VB.NET)
'Imports System.Web.Mail
Imports System.Net.Mail.SmtpClient
Imports System.Net.Mail.MailMessage
Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Imports System.Data.OleDb
Imports System.Net.Mail
Imports System.Net.Mime
Imports System.Net
Partial Public Class sendemail2
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
Dim mail As New MailMessage()
'*ข้อมูลในส่วน detail
Dim htmlstring As String = txtDescription.Text
'*
'**ข้อมูล EMAIL ผู้ส่ง
mail.From = New MailAddress("[email protected]", "Support by SMS:Service :: Arkachai CarCare ::")
'**
'*** EMAIL คนรับ
mail.[To].Add(New MailAddress(txtTo.Text))
'***
mail.Subject = txtSubject.Text
mail.IsBodyHtml = True
mail.Body = htmlstring
Dim smtp As New SmtpClient("smtp.gmail.com")
smtp.UseDefaultCredentials = False
smtp.EnableSsl = True
smtp.Credentials = New NetworkCredential("[email protected]", "XXXXX")
smtp.Send(mail)
mail.Dispose()
End Sub
End Class