Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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]
- mail.To.Add(new MailAddress(EmailTo, ToName));
- Are you using ASp.NET Membership?? If so, you can try this
- using System.Web.Security;
- MembershipUser user = Membership.GetUser(HttpContext.Current.User.Identity.Name);
- if (user != null)
- {
- string username = user.UserName;
- //set your label text here
- }
Add Comment
Please, Sign In to add comment