EmailController.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. namespace App\Common\Email;
  3. use \App\Core\Template\Output as Output;
  4. use \App\Core\Email\Classes\Email as Email;
  5. use PHPMailer\PHPMailer\PHPMailer;
  6. use PHPMailer\PHPMailer\SMTP;
  7. use PHPMailer\PHPMailer\Exception;
  8. class EmailController extends \DefaultController
  9. {
  10. protected $_class = Email::class;
  11. protected $_baseUrl = '/email';
  12. /**
  13. * Index
  14. * Show the main Email list
  15. */
  16. function index()
  17. {
  18. Output::render('index');
  19. /*
  20. $mail = new PHPMailer(true);
  21. // Server settings
  22. $mail->SMTPDebug = SMTP::DEBUG_SERVER; // for detailed debug output
  23. $mail->isSMTP();
  24. $mail->Host = 'smtp.gmail.com';
  25. $mail->SMTPAuth = true;
  26. $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
  27. $mail->Port = 587;
  28. $mail->Username = 'ahwelp@universo.univates.br';
  29. $mail->Password = '********';
  30. // Sender and recipient settings
  31. $mail->setFrom('ahwelp@universo.univates.br', 'Sender Name');
  32. $mail->addAddress('ahwelp@univates.br', 'Receiver Name');
  33. $mail->addReplyTo('ahwelp@universo.univates.br', 'Sender Name');
  34. // Setting the email content
  35. $mail->IsHTML(true);
  36. $mail->Subject = "Send email using Gmail SMTP and PHPMailer";
  37. $mail->Body = 'HTML message body. <b>Gmail</b> SMTP email body.';
  38. $mail->AltBody = 'Plain text message body for non-HTML email client. Gmail SMTP email body.';
  39. $mail->send();
  40. echo "Email message sent.";*/
  41. }
  42. /**
  43. * Create
  44. *
  45. * Render the main Email formulary
  46. */
  47. function create()
  48. {
  49. Output::render('form', ['id' => 0]);
  50. }
  51. /**
  52. * Store
  53. *
  54. * Store the param on the database
  55. * @param Email $email
  56. */
  57. function store(Email $email)
  58. {
  59. }
  60. /**
  61. * Search
  62. *
  63. * Store the param on the database
  64. * @param Email $email
  65. */
  66. function search()
  67. {
  68. }
  69. /**
  70. * Show
  71. *
  72. * Render one register
  73. *
  74. * @param Email $email
  75. */
  76. function show(Email $email)
  77. {
  78. }
  79. /**
  80. * Edit
  81. *
  82. * Render the formular for a database Email
  83. *
  84. * @param Email $email
  85. */
  86. function edit(Email $email)
  87. {
  88. Output::render('form', $email);
  89. }
  90. /**
  91. * Update
  92. * Store the changes of the param on the database
  93. *
  94. * @param Email $email
  95. */
  96. function update(Email $email)
  97. {
  98. }
  99. /**
  100. * Destroy
  101. * If the object has soft delete.
  102. *
  103. * @param Email $email
  104. */
  105. function destroy(Email $email)
  106. {
  107. }
  108. /**
  109. * Purge
  110. * Remove object even with soft delete.
  111. *
  112. * @param Email $email
  113. */
  114. function purge(Email $email)
  115. {
  116. }
  117. }