Thanks for replying me and this is the whole my code.
I think there is something wrong on that so Can you help me how can i fix it and work fine.
it work but when i check my email box so i can not receive any letter from submit form.
Shared Function GMailSend(ByVal mailFrom As MailAddress, ByVal mailTo As MailAddress, ByVal strSubject As String, ByVal strContent As String, Optional ByVal CCaddress As String = "", Optional ByVal BCCaddress As String = "") As Boolean
Dim mail As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()
Dim kq As Boolean
mail.From = mailFrom
mail.To.Add(mailTo)
mail.Subject = strSubject
mail.Body = strContent
mail.IsBodyHtml = True
mail.BodyEncoding = System.Text.Encoding.UTF8
mail.ReplyTo = mailFrom
If CCaddress.Length > 7 Then mail.CC.Add(CCaddress)
If BCCaddress.Length > 7 Then mail.Bcc.Add(BCCaddress)
Dim credential As System.Net.NetworkCredential = New System.Net.NetworkCredential("
[email protected] m", "password")
Dim smtp As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient("smtp.gmail.com")
smtp.Credentials = credential
smtp.UseDefaultCredentials = False
smtp.EnableSsl = True
smtp.Port = 587 'also tried 587,465, 25
smtp.Host = "smtp.gmail.com"
Try
smtp.Send(mail)
kq = True
Catch ex As Exception
kq = False
End Try
Return kq
End Function
Thanks for all thing.
Best Regards,
Phuc Hoang