23 private $mode = self::MODE_DIRECT_REGISTRATION;
37 parent::__construct(
false);
54 $clone->mode = self::MODE_DIRECT_REGISTRATION;
65 $clone->mode = self::MODE_REGISTRATION_WITH_EMAIL_CONFIRMATION;
77 isset($mailData[
'body']) &&
78 is_string($mailData[
'body']) &&
79 $mailData[
'body'] !==
'' &&
80 isset($mailData[
'subject']) &&
81 is_string($mailData[
'subject']) &&
82 $mailData[
'subject'] !==
'' 93 $trimStrings =
function ($value) {
94 if (is_string($value)) {
95 $value = trim($value);
101 $this->logger->debug(sprintf(
102 "Trying to send configurable email dependent welcome email to user %s (id: %s|language: %s) ...",
109 if (!is_array($mailData)) {
110 $this->logger->debug(sprintf(
111 "Did not find any email configuration for language '%s' at all, skipping attempt ...",
117 $mailData = array_map($trimStrings, $mailData);
120 $this->logger->debug(sprintf(
121 "Either subject or email missing, trying to determine email configuration via default language: %s",
122 $this->language->getDefaultLanguage()
126 if (!is_array($mailData)) {
127 $this->logger->debug(sprintf(
128 "Did not find any email configuration for language '%s' at all, skipping attempt ...",
129 $this->language->getDefaultLanguage()
134 $mailData = array_map($trimStrings, $mailData);
136 $this->logger->debug(sprintf(
137 "Did not find any valid email configuration, skipping attempt ..." 144 $accountMail->setUser($user);
146 if ($this->
settings->passwordGenerationEnabled()) {
147 $accountMail->setUserPassword($rawPassword);
150 if (isset($mailData[
'att_file'])) {
154 $pathToFile =
'/' . implode(
'/', array_map(
function ($pathPart) {
155 return trim($pathPart,
'/');
157 $fs->getAbsolutePath(),
161 $accountMail->addAttachment($pathToFile, $mailData[
'att_file']);
163 $this->logger->debug(sprintf(
164 "Attaching '%s' as '%s' ...",
166 $mailData[
'att_file']
169 $this->logger->debug(sprintf(
170 "Not attachments configured for this email configuration ..." 174 $accountMail->send();
176 $this->logger->debug(sprintf(
190 $this->logger->debug(sprintf(
191 "Sending language variable dependent welcome email to user %s (id: %s|language: %s) as fallback ...",
197 $this->initMimeMail();
201 $this->
setSubject($this->language->txt(
'reg_mail_subject'));
203 $this->
setBody($this->language->txt(
'reg_mail_body_salutation') .
' ' . $user->
getFullname() .
',');
205 $this->
appendBody($this->language->txt(
'reg_mail_body_text1'));
207 $this->
appendBody($this->language->txt(
'reg_mail_body_text2'));
209 $this->
appendBody(ILIAS_HTTP_PATH .
'/login.php?client_id=' . CLIENT_ID);
214 if ($this->
settings->passwordGenerationEnabled()) {
215 $this->
appendBody($this->language->txt(
'passwd') .
': ' . $rawPassword);
219 if ($this->
getMode() === self::MODE_DIRECT_REGISTRATION) {
222 $this->
appendBody($this->language->txt(
'reg_mail_body_pwd_generation'));
225 } elseif ($this->
getMode() === self::MODE_REGISTRATION_WITH_EMAIL_CONFIRMATION) {
227 $this->
appendBody($this->language->txt(
'reg_mail_body_forgot_password_info'));
231 $this->
appendBody($this->language->txt(
'reg_mail_body_text3'));
233 $this->
appendBody($user->getProfileAsString($this->language));
238 $this->logger->debug(sprintf(
248 public function send(
ilObjUser $user, $rawPassword =
'', $usedRegistrationCode =
false)
getLogin()
get login / username public
sendLanguageVariableBasedAccountMail(ilObjUser $user, $rawPassword, $usedRegistrationCode)
initLanguageByIso2Code($a_code='')
getEmail()
get email address public
Class ilAccountRegistrationMail.
getId()
get object id public
static _lookupNewAccountMail($a_lang)
withEmailConfirmationRegistrationMode()
const MODE_REGISTRATION_WITH_EMAIL_CONFIRMATION
__construct(ilRegistrationSettings $settings, ilLanguage $lng, ilLogger $logger)
ilAccountRegistrationMail constructor.
getFullname($a_max_strlen=0)
get fullname public
Base class for mime mail notifications.
send(ilObjUser $user, $rawPassword='', $usedRegistrationCode=false)
withDirectRegistrationMode()
appendBody($a_body)
Append body text.
const USER_FOLDER_ID
Class ilObjUserFolder.
Component logger with individual log levels by component id.
isEmptyMailConfigurationData($mailData)
getLanguage()
returns a 2char-language-string public
trySendingUserDefinedAccountMail(ilObjUser $user, $rawPassword)
const MODE_DIRECT_REGISTRATION
static _getInstallationSignature()