UserMailer.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * Manage the emails sent to the users.
  5. */
  6. class FreshRSS_User_Mailer extends Minz_Mailer {
  7. /**
  8. * @var FreshRSS_View
  9. */
  10. protected $view;
  11. public function __construct() {
  12. parent::__construct(FreshRSS_View::class);
  13. }
  14. public function send_email_need_validation(string $username, FreshRSS_UserConfiguration $user_config): bool {
  15. Minz_Translate::reset($user_config->language);
  16. $this->view->_path('user_mailer/email_need_validation.txt.php');
  17. $this->view->username = $username;
  18. $this->view->site_title = FreshRSS_Context::systemConf()->title;
  19. $this->view->validation_url = Minz_Url::display(
  20. [
  21. 'c' => 'user',
  22. 'a' => 'validateEmail',
  23. 'params' => [
  24. 'username' => $username,
  25. 'token' => $user_config->email_validation_token,
  26. ],
  27. ],
  28. 'txt',
  29. true
  30. );
  31. $subject_prefix = '[' . FreshRSS_Context::systemConf()->title . ']';
  32. return $this->mail(
  33. $user_config->mail_login,
  34. $subject_prefix . ' ' . _t('user.mailer.email_need_validation.title')
  35. );
  36. }
  37. }