ILIAS  release_8 Revision v8.23
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  protected ilSetting $settings;
28  protected ilObjUser $user;
29 
30  public function __construct(ilSetting $settings, ilObjUser $user)
31  {
32  $this->settings = $settings;
33  $this->user = $user;
34  }
35 
36  public function hasReplyToAddress(): bool
37  {
38  return true;
39  }
40 
41  public function getReplyToAddress(): string
42  {
43  if (
44  true === (bool) $this->settings->get('use_global_reply_to_addr', '0') &&
45  is_string($this->settings->get('global_reply_to_addr', '')) &&
46  $this->settings->get('global_reply_to_addr', '') !== ''
47  ) {
48  return $this->settings->get('global_reply_to_addr', '');
49  }
50 
51  return $this->user->getEmail();
52  }
53 
54  public function getReplyToName(): string
55  {
56  return $this->user->getFullname();
57  }
58 
59  public function hasEnvelopFromAddress(): bool
60  {
61  return $this->settings->get('mail_system_usr_env_from_addr', '') !== '' && $this->settings->get('mail_system_usr_env_from_addr', '') !== null;
62  }
63 
64  public function getEnvelopFromAddress(): string
65  {
66  return $this->settings->get('mail_system_usr_env_from_addr', '');
67  }
68 
69  public function getFromAddress(): string
70  {
71  return $this->settings->get('mail_system_usr_from_addr', '');
72  }
73 
74  public function getFromName(): string
75  {
76  $from = $this->settings->get('mail_system_usr_from_name', '');
77  if ($from === '') {
78  return $this->user->getFullname();
79  }
80 
81  $name = str_ireplace('[FULLNAME]', $this->user->getFullname(), $from);
82  $name = str_ireplace('[FIRSTNAME]', $this->user->getFirstname(), $name);
83  $name = str_ireplace('[LASTNAME]', $this->user->getLastname(), $name);
84  if ($name !== $from) {
85  return $name;
86  }
87 
88  return $from;
89  }
90 }
Class ilMailMimeSenderSystem.
if($format !==null) $name
Definition: metadata.php:247
Interface ilMailMimeTransport.
__construct(ilSetting $settings, ilObjUser $user)