FIX #10950 TIME 0:15 set phpmailer From in all cases to send email + rm disabled…

FIX #10950 TIME 0:15 set phpmailer From in all cases to send email + rm disabled attributes + wording
parent 18adc7a5
......@@ -301,7 +301,7 @@ switch ($mode) {
$userInfo = \User\models\UserModel::getByLogin(['login' => $_SESSION['user']['UserId'], 'select' => ['id', 'mail']]);
$aSenderInfo = explode(",", $_REQUEST['sender_email']);
if (!empty($aSenderInfo[1])) {
if (!empty($aSenderInfo[1]) && !empty($aSenderInfo[0])) {
$entityInfo = \Entity\models\EntityModel::getByEntityId(['entityId' => $aSenderInfo[0], 'select' => ['id']]);
}
$isSent = \Email\controllers\EmailController::createEmail([
......
......@@ -247,6 +247,17 @@ class EmailController
$phpmailer = new PHPMailer();
$emailFrom = empty($configuration['from']) ? $email['sender']['email'] : $configuration['from'];
if (empty($email['sender']['entityId'])) {
// Usefull for old sendmail server which doesn't support accent encoding
$setFrom = TextFormatModel::normalize(['string' => "{$user['firstname']} {$user['lastname']}"]);
$phpmailer->setFrom($emailFrom, ucwords($setFrom));
} else {
$entity = EntityModel::getById(['id' => $email['sender']['entityId'], 'select' => ['short_label']]);
// Usefull for old sendmail server which doesn't support accent encoding
$setFrom = TextFormatModel::normalize(['string' => $entity['short_label']]);
$phpmailer->setFrom($emailFrom, ucwords($setFrom));
}
if (in_array($configuration['type'], ['smtp', 'mail'])) {
if ($configuration['type'] == 'smtp') {
$phpmailer->isSMTP();
......@@ -267,18 +278,6 @@ class EmailController
$phpmailer->Password = PasswordModel::decrypt(['cryptedPassword' => $configuration['password']]);
}
}
$emailFrom = empty($configuration['from']) ? $email['sender']['email'] : $configuration['from'];
if (empty($email['sender']['entityId'])) {
// Usefull for old sendmail server which doesn't support accent encoding
$setFrom = TextFormatModel::normalize(['string' => "{$user['firstname']} {$user['lastname']}"]);
$phpmailer->setFrom($emailFrom, ucwords($setFrom));
} else {
$entity = EntityModel::getById(['id' => $email['sender']['entityId'], 'select' => ['short_label']]);
// Usefull for old sendmail server which doesn't support accent encoding
$setFrom = TextFormatModel::normalize(['string' => $entity['short_label']]);
$phpmailer->setFrom($emailFrom, ucwords($setFrom));
}
} elseif ($configuration['type'] == 'sendmail') {
$phpmailer->isSendmail();
} elseif ($configuration['type'] == 'qmail') {
......
......@@ -103,7 +103,7 @@
(opened)="onSubmit();initEmailSend()">
<mat-nav-list disableRipple="true" style="display: flex;flex-direction: column;">
<h3 mat-subheader>{{lang.emailSendTest}}</h3>
<div class="form-group" [style.opacity]="['smtp', 'mail'].indexOf(sendmail.type) > -1 ? '1' : '0.5'">
<div class="form-group">
<div class="col-md-12">
<form #testSendmailForm="ngForm">
<mat-form-field>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment