Advertisement
Guest User

Untitled

a guest
May 31st, 2017
600
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. Protected Sub Email_Click(sender As Object, e As EventArgs) Handles Email.Click
  2. Using mail As New MailMessage("recipient@gmail.com", "youremail@gmail.com")
  3.  
  4. mail.Subject = "this is a test"
  5. mail.Body = "This is confirmation for the recent purchase in CIS 451. Your total cost was " & lblTotal.Text & ". Thank you for shopping with us!"
  6. Dim smtp As New SmtpClient()
  7. smtp.Host = "smtp.gmail.com"
  8. smtp.EnableSsl = True
  9.  
  10. Dim NetworkCred As New NetworkCredential("youremail@gmail.com", "password")
  11. smtp.UseDefaultCredentials = True
  12. smtp.Credentials = NetworkCred
  13. smtp.Port = 587
  14. Try
  15. smtp.Send(mail)
  16. Response.Write("Your Email has been sent sucessfully - Thank You")
  17. Response.Redirect("Summary.aspx")
  18. Catch exc As Exception
  19. Response.Write("Send failure: " & exc.ToString())
  20. End Try
  21. End Using
  22. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement