Monday, April 30, 2012

Mail Sending in VB.NET


Dim msg As New MailMessage()
                    Dim EmailAdress As New MailAddress("admin@xxx.com")
                    Dim smtpmail As New SmtpClient()
                    msg.To.Add(txtEmail.Text)
                    msg.From = EmailAdress
                    msg.Subject = "COS Password"
                    'msg.BodyFormat = MailFormat.Html
                    'msg.BodyFormat = MailFormat.Text
                    smtpmail.Host = "smtp.gmail.com"
                    smtpmail.EnableSsl = True
                    smtpmail.Port = 587
                    smtpmail.Credentials = New System.Net.NetworkCredential("xxxx@gmail.com", "xxx")
                    msg.Body = "Your password for xxx website is : " & dtPassword.Rows(0)("Password")
                    smtpmail.Send(msg)
                    msg = Nothing
                    lblMsg.Text = "An Email has been send to " & txtEmail.Text

No comments:

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...