ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMailTransportSettings.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
3
9{
10 private $mailOptions;
11
13 {
14 $this->mailOptions = $mailOptions;
15 }
16
23 public function adjust($firstMail, $secondMail)
24 {
25 if ($this->mailOptions->getIncomingType() === ilMailOptions::INCOMING_LOCAL) {
26 return;
27 }
28
29 $hasFirstEmail = strlen($firstMail);
30 $hasSecondEmail = strlen($secondMail);
31
32 if (!$hasFirstEmail && !$hasSecondEmail) {
33 $this->mailOptions->setIncomingType(ilMailOptions::INCOMING_LOCAL);
34 return $this->mailOptions->updateOptions();
35 }
36
37 if (!$hasFirstEmail && $this->mailOptions->getMailAddressOption() !== ilMailOptions::SECOND_EMAIL) {
38 $this->mailOptions->setMailAddressOption(ilMailOptions::SECOND_EMAIL);
39 return $this->mailOptions->updateOptions();
40 }
41
42 if (!$hasSecondEmail && $this->mailOptions->getMailAddressOption() !== ilMailOptions::FIRST_EMAIL) {
43 $this->mailOptions->setMailAddressOption(ilMailOptions::FIRST_EMAIL);
44 return $this->mailOptions->updateOptions();
45 }
46 }
47}
An exception for terminatinating execution or to throw for unit testing.
Class ilMailOptions this class handles user mails.
adjust($firstMail, $secondMail)
Validates the current instance settings and eventually adjusts these.
__construct(ilMailOptions $mailOptions)