Hi all,
I have to send an email in VB.Net 2005 and successfully it works. But now I have a problem I want to validate the txtformbox that the users should enter a validate email. For example they should put @ symbol.
So any volunteer to help me???
I am looking forward to answering my email.
Here you are the code:
Private Sub btnSend_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles btnSend.Click
'Create mail object'
Dim mail As New MailMessage()
'Set Adresses'
mail.From = New MailAddress(txt From.Text)
mail.To.Add(txt To.Text)
'Set the content
mail.Subject = txtSubject.Text
mail.Body = txtContent.Text
'Create Smtp object'
Dim smtp As New SmtpClient("loc alhost")
'Send email'
smtp.Send(mail)
'Show message that the email has been sent to the person'
MsgBox("Success fully message has been sent.", MsgBoxStyle.Inf ormation, "Confirmati on Message")
End Sub
Regards,
Aisha
I have to send an email in VB.Net 2005 and successfully it works. But now I have a problem I want to validate the txtformbox that the users should enter a validate email. For example they should put @ symbol.
So any volunteer to help me???
I am looking forward to answering my email.
Here you are the code:
Private Sub btnSend_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles btnSend.Click
'Create mail object'
Dim mail As New MailMessage()
'Set Adresses'
mail.From = New MailAddress(txt From.Text)
mail.To.Add(txt To.Text)
'Set the content
mail.Subject = txtSubject.Text
mail.Body = txtContent.Text
'Create Smtp object'
Dim smtp As New SmtpClient("loc alhost")
'Send email'
smtp.Send(mail)
'Show message that the email has been sent to the person'
MsgBox("Success fully message has been sent.", MsgBoxStyle.Inf ormation, "Confirmati on Message")
End Sub
Regards,
Aisha
Comment