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