37 parent::__construct(
false);
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);
102 "Trying to send configurable email dependent welcome email to user %s (id: %s|language: %s) ...",
109 if (!is_array($mailData)) {
111 "Did not find any email configuration for language '%s' at all, skipping attempt ...",
117 $mailData = array_map($trimStrings, $mailData);
121 "Either subject or email missing, trying to determine email configuration via default language: %s",
122 $this->language->getDefaultLanguage()
126 if (!is_array($mailData)) {
128 "Did not find any email configuration for language '%s' at all, skipping attempt ...",
129 $this->language->getDefaultLanguage()
134 $mailData = array_map($trimStrings, $mailData);
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']);
164 "Attaching '%s' as '%s' ...",
166 $mailData[
'att_file']
170 "Not attachments configured for this email configuration ..."
174 $accountMail->send();
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));
248 public function send(
ilObjUser $user, $rawPassword =
'', $usedRegistrationCode =
false)
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
const USER_FOLDER_ID
Class ilObjUserFolder.
Class ilAccountRegistrationMail.
sendLanguageVariableBasedAccountMail(ilObjUser $user, $rawPassword, $usedRegistrationCode)
const MODE_DIRECT_REGISTRATION
send(ilObjUser $user, $rawPassword='', $usedRegistrationCode=false)
__construct(ilRegistrationSettings $settings, ilLanguage $lng, ilLogger $logger)
ilAccountRegistrationMail constructor.
withDirectRegistrationMode()
const MODE_REGISTRATION_WITH_EMAIL_CONFIRMATION
trySendingUserDefinedAccountMail(ilObjUser $user, $rawPassword)
isEmptyMailConfigurationData($mailData)
withEmailConfirmationRegistrationMode()
Component logger with individual log levels by component id.
appendBody($a_body)
Append body text.
static _getInstallationSignature()
Base class for mime mail notifications.
initLanguageByIso2Code($a_code='')
static _lookupNewAccountMail($a_lang)
getEmail()
get email address @access public
getLogin()
get login / username @access public
getFullname($a_max_strlen=0)
get fullname @access public
getLanguage()
returns a 2char-language-string @access public
getId()
get object id @access public
Class ilObjAuthSettingsGUI.