KahnClifford

controller.MailAPI

Jul 21st, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. package controller;
  2.  
  3. import static java.lang.ProcessBuilder.Redirect.from;
  4. import java.util.Properties;
  5. import javax.mail.PasswordAuthentication;
  6. import javax.mail.Session;
  7.  
  8. public class MailAPI {
  9.  
  10.  
  11. private model.MailAPI model;
  12. private String errorMsg;
  13.  
  14. public MailAPI() {
  15. model = new model.MailAPI();
  16. }
  17.  
  18. public MailAPI(String prmEmail, char[] prmPassword) {
  19. model = new model.MailAPI(prmEmail, prmPassword);
  20. }
  21.  
  22. public String getError(){
  23. return model.getError();
  24. }
  25.  
  26. public String getTo(){
  27. return model.getTo();
  28. }
  29.  
  30. public String getFrom(){
  31. return model.getFrom();
  32. }
  33.  
  34. public boolean emptyPassword(){
  35. return model.emptyPassword();
  36. }
  37.  
  38. public void getEmails(){
  39. model.getEmails();
  40. }
  41.  
  42. public void sendMsg(String prmSub, String prmMsg){
  43. model.sendMsg(prmMsg, prmMsg);
  44. }
  45.  
  46. public void setRecipient(String prmTo){
  47. model.setRecipient(prmTo);
  48. }
  49.  
  50. public static void main(String[] args) {
  51. controller.MailAPI mail = new controller.MailAPI();
  52. mail.getEmails();
  53. }
  54.  
  55. public boolean sendHashMsg(String prmEmail, int prmHash){
  56.  
  57. if(prmEmail != null && prmHash != 0){
  58. this.setRecipient(prmEmail);
  59. String hashStr = String.valueOf(prmHash);
  60. this.sendMsg("Java Mail - Verification", hashStr);
  61. return true;
  62. }else{
  63. return false;
  64. }
  65. }
  66.  
  67. }
Add Comment
Please, Sign In to add comment