I want to display the User’s name in email. I have successfully sent an email to a mail id and now i want along with mail id i want to display user’s name also.
Here is my code please help me as soon as possible.
Public Sub SendMail(ByVal EmailFrom As String, ByVal FromName As String, ByVal ToName As String, ByVal EmailTo As String, ByVal MailSubject As String, ByVal MailBody As String, ByVal Bcc As Int32)
Try
Dim mail As New MailMessage()
Dim smtp As New SmtpClient()
mail.From = New MailAddress(EmailFrom, FromName)
mail.To.Add(EmailTo)
mail.Subject = MailSubject
mail.Body = MailBody
mail.IsBodyHtml = True
smtp.Host = "smtp.gmail.com"
smtp.Credentials = New System.Net.NetworkCredential("example@gmail.com","abc")
smtp.Send(mail)
Catch ex As Exception
End Try
End Sub![enter image description here][1]
You can use the same logic from the mail.From address.