Internal: Admin: Move ENV parameters about smpt* to mail settings - refs BT#21613

pull/5462/head
Angel Fernando Quiroz Campos 1 year ago
parent bb5ca1c0f3
commit 9b89b3a277
  1. 4
      .env.dist
  2. 3
      config/services.yaml
  3. 6
      public/main/admin/email_tester.php
  4. 2
      public/main/inc/lib/api.lib.php
  5. 4
      public/main/inc/lib/notification.lib.php
  6. 7
      src/CoreBundle/Settings/MailSettingsSchema.php

@ -37,10 +37,6 @@ APP_MULTIPLE_ACCESS_URL=''
GOOGLE_MAPS_API_KEY='' GOOGLE_MAPS_API_KEY=''
APP_SMTP_UNIQUE_SENDER=0
APP_SMTP_FROM_EMAIL=''
APP_SMTP_FROM_NAME=''
#APP_API_PLATFORM_URL='http://localhost/api/' #deprecated #APP_API_PLATFORM_URL='http://localhost/api/' #deprecated
###< chamilo ### ###< chamilo ###

@ -7,9 +7,6 @@ parameters:
locale: '%env(APP_LOCALE)%' locale: '%env(APP_LOCALE)%'
installed: '%env(APP_INSTALLED)%' installed: '%env(APP_INSTALLED)%'
multiple_access_url: '%env(APP_MULTIPLE_ACCESS_URL)%' multiple_access_url: '%env(APP_MULTIPLE_ACCESS_URL)%'
smtp_unique_sender: '%env(APP_SMTP_UNIQUE_SENDER)%'
smtp_from_email: '%env(APP_SMTP_FROM_EMAIL)%'
smtp_from_name: '%env(APP_SMTP_FROM_NAME)%'
container.dumper.inline_factories: true container.dumper.inline_factories: true
twig: twig:
form: form:

@ -13,6 +13,8 @@ require_once __DIR__.'/../inc/global.inc.php';
api_protect_admin_script(); api_protect_admin_script();
$settingsManager = Container::getSettingsManager();
// Setting the section (for the tabs). // Setting the section (for the tabs).
$this_section = SECTION_PLATFORM_ADMIN; $this_section = SECTION_PLATFORM_ADMIN;
$toolName = get_lang('E-mail tester'); $toolName = get_lang('E-mail tester');
@ -44,8 +46,8 @@ if ($form->validate()) {
$values['subject'], $values['subject'],
$values['content'], $values['content'],
UserManager::formatUserFullName($user), UserManager::formatUserFullName($user),
true === (bool) Container::getParameter('smtp_unique_sender') 'true' === $settingsManager->getSetting('mail.smtp_unique_sender')
? Container::getParameter('smtp_from_email') ? $settingsManager->getSetting('mail.smtp_from_email')
: $user->getEmail() : $user->getEmail()
); );

@ -7137,7 +7137,7 @@ function api_set_noreply_and_from_address_to_mailer(
$email->addReplyTo(new Address($replyToAddress['mail'], $replyToAddress['name'])); $email->addReplyTo(new Address($replyToAddress['mail'], $replyToAddress['name']));
} }
if (true === (bool) Container::getParameter('smtp_unique_sender')) { if ('true' === api_get_setting('mail.smtp_unique_sender')) {
$senderName = $defaultSenderName; $senderName = $defaultSenderName;
$senderEmail = $defaultSenderEmail; $senderEmail = $defaultSenderEmail;

@ -61,10 +61,10 @@ class Notification extends Model
{ {
$this->table = Database::get_main_table(TABLE_NOTIFICATION); $this->table = Database::get_main_table(TABLE_NOTIFICATION);
if ($smtpFromEmail = Container::getParameter('smtp_from_email')) { if ($smtpFromEmail = api_get_setting('mail.smtp_from_email')) {
$this->adminEmail = $smtpFromEmail; $this->adminEmail = $smtpFromEmail;
if ($smtpFromName = Container::getParameter('smtp_from_name')) { if ($smtpFromName = api_get_setting('mail.smtp_from_name')) {
$this->adminName = $smtpFromName; $this->adminName = $smtpFromName;
} }
} else { } else {

@ -31,6 +31,10 @@ class MailSettingsSchema extends AbstractSettingsSchema
'send_notification_score_in_percentage' => 'false', 'send_notification_score_in_percentage' => 'false',
'cron_notification_help_desk' => '', 'cron_notification_help_desk' => '',
'notifications_extended_footer_message' => '', 'notifications_extended_footer_message' => '',
'smtp_unique_sender' => 'false',
'smtp_from_email' => '',
'smtp_from_name' => '',
] ]
) )
; ;
@ -65,6 +69,9 @@ class MailSettingsSchema extends AbstractSettingsSchema
'help' => $this->settingArrayHelpValue('notifications_extended_footer_message'), 'help' => $this->settingArrayHelpValue('notifications_extended_footer_message'),
] ]
) )
->add('smtp_unique_sender', YesNoType::class)
->add('smtp_from_email', EmailType::class)
->add('smtp_from_name', TextType::class)
; ;
$this->updateFormFieldsFromSettingsInfo($builder); $this->updateFormFieldsFromSettingsInfo($builder);

Loading…
Cancel
Save