UserMailer.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. * @phpstan-ignore property.phpDocType
  10. */
  11. protected $view;
  12. public function __construct() {
  13. parent::__construct(FreshRSS_View::class);
  14. }
  15. public function send_email_need_validation(string $username, FreshRSS_UserConfiguration $user_config): bool {
  16. Minz_Translate::reset($user_config->language);
  17. $this->view->_path('user_mailer/email_need_validation.txt.php');
  18. $this->view->username = $username;
  19. $this->view->site_title = FreshRSS_Context::systemConf()->title;
  20. $this->view->validation_url = Minz_Url::display(
  21. [
  22. 'c' => 'user',
  23. 'a' => 'validateEmail',
  24. 'params' => [
  25. 'username' => $username,
  26. 'token' => $user_config->email_validation_token,
  27. ],
  28. ],
  29. 'txt',
  30. true
  31. );
  32. $subject_prefix = '[' . FreshRSS_Context::systemConf()->title . ']';
  33. return $this->mail(
  34. $user_config->mail_login,
  35. $subject_prefix . ' ' . _t('user.mailer.email_need_validation.title')
  36. );
  37. }
  38. }