ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilMailMimeSenderUser.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
25 abstract class ilMailMimeSenderUser implements ilMailMimeSender
26 {
27  public function __construct(
28  protected ilSetting $settings,
29  protected ilObjUser $user,
30  protected ilMustacheFactory $mustache_factory
31  ) {
32  }
33 
34  public function hasReplyToAddress(): bool
35  {
36  return true;
37  }
38 
39  public function getReplyToAddress(): string
40  {
41  if (
42  (bool) $this->settings->get('use_global_reply_to_addr', '0') &&
43  is_string($this->settings->get('global_reply_to_addr', '')) &&
44  $this->settings->get('global_reply_to_addr', '') !== ''
45  ) {
46  return $this->settings->get('global_reply_to_addr', '');
47  }
48 
49  return $this->user->getEmail();
50  }
51 
52  public function getReplyToName(): string
53  {
54  return $this->user->getFullname();
55  }
56 
57  public function hasEnvelopFromAddress(): bool
58  {
59  return $this->settings->get('mail_system_usr_env_from_addr', '') !== '' && $this->settings->get(
60  'mail_system_usr_env_from_addr',
61  ''
62  ) !== null;
63  }
64 
65  public function getEnvelopFromAddress(): string
66  {
67  return $this->settings->get('mail_system_usr_env_from_addr', '');
68  }
69 
70  public function getFromAddress(): string
71  {
72  return $this->settings->get('mail_system_usr_from_addr', '');
73  }
74 
75  public function getFromName(): string
76  {
77  $from = $this->settings->get('mail_system_usr_from_name', '');
78  if ($from === '') {
79  return $this->user->getFullname();
80  }
81 
82  $placeholders = [
83  'FULLNAME' => $this->user->getFullname(),
84  'FIRSTNAME' => $this->user->getFirstname(),
85  'LASTNAME' => $this->user->getLastname(),
86  ];
87 
88  $template = $from;
89  $interpolated = $this->mustache_factory->getBasicEngine()->render($template, $placeholders);
90 
91  if ($template !== $interpolated) {
92  return $interpolated;
93  }
94 
95  return $template;
96  }
97 }
Class ilMailMimeSenderSystem.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Interface ilMailMimeTransport.
__construct(protected ilSetting $settings, protected ilObjUser $user, protected ilMustacheFactory $mustache_factory)