ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilMailMimeSenderUser.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2/* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8abstract class ilMailMimeSenderUser implements ilMailMimeSender
9{
11 protected $settings;
12
14 protected $user;
15
22 {
23 $this->settings = $settings;
24 $this->user = $user;
25 }
26
30 public function hasReplyToAddress() : bool
31 {
32 return true;
33 }
34
38 public function getReplyToAddress() : string
39 {
40 return (string) $this->user->getEmail();
41 }
42
46 public function getReplyToName() : string
47 {
48 return (string) $this->user->getFullname();
49 }
50
54 public function hasEnvelopFromAddress() : bool
55 {
56 return strlen($this->settings->get('mail_system_usr_env_from_addr')) > 0;
57 }
58
62 public function getEnvelopFromAddress() : string
63 {
64 return $this->settings->get('mail_system_usr_env_from_addr', '');
65 }
66
70 public function getFromAddress() : string
71 {
72 return $this->settings->get('mail_system_usr_from_addr', '');
73 }
74
78 public function getFromName() : string
79 {
80 $from = $this->settings->get('mail_system_usr_from_name', '');
81 if (0 == strlen($from)) {
82 return (string) $this->user->getFullname();
83 }
84
85 $name = str_ireplace('[FULLNAME]', (string) $this->user->getFullname(), $from);
86 $name = str_ireplace('[FIRSTNAME]', (string) $this->user->getFirstname(), $name);
87 $name = str_ireplace('[LASTNAME]', (string) $this->user->getLastname(), $name);
88 if ($name !== $from) {
89 return $name;
90 }
91
92 return $from;
93 }
94}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
Class ilMailMimeSenderSystem.
__construct(ilSetting $settings, ilObjUser $user)
ilMailMimeSenderSystem constructor.
ILIAS Setting Class.
Interface ilMailMimeTransport.
if($format !==null) $name
Definition: metadata.php:230
settings()
Definition: settings.php:2