diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 17846b05452..c3792812210 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -529,209 +529,213 @@ if ($action == 'edit') if (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) print img_warning($langs->trans("Disabled")); print ''; - // Force e-mail recipient - print '
| '.$langs->trans("MAIN_MAIL_SENDMODE").' |
| '.$langs->trans("MAIN_MAIL_SENDMODE").' | |
| '.$langs->trans("MAIN_MAIL_SENDMODE").' | '; - $text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE]; - if (empty($text)) $text = $langs->trans("Undefined").img_warning(); - print $text; + // Method + print ' |
| '.$langs->trans("MAIN_MAIL_SENDMODE").' | ';
+ $text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE];
+ if (empty($text)) $text = $langs->trans("Undefined").img_warning();
+ print $text;
- if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
- print $form->textwithpicto('', $langs->trans("WarningPHPMail").' '.$langs->trans("WarningPHPMailA").' '.$langs->trans("WarningPHPMailB").' '.$langs->trans("WarningPHPMailC").' '.$langs->trans("WarningPHPMailD"), 1, 'warning'); - } + if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { + print $form->textwithpicto('', $langs->trans("WarningPHPMail").' '.$langs->trans("WarningPHPMailA").' '.$langs->trans("WarningPHPMailB").' '.$langs->trans("WarningPHPMailC").' '.$langs->trans("WarningPHPMailD"), 1, 'warning'); + } - print ' |
| '.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").' | '.$langs->trans("SeeLocalSendMailSetup").' |
| '.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).' | '.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').' |
| '.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").' | '.$langs->trans("SeeLocalSendMailSetup").' |
| '.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).' | '.(!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '').' |
| '.$langs->trans("MAIN_MAIL_SMTPS_ID").' | '.$conf->global->MAIN_MAIL_SMTPS_ID.' |
| '.$langs->trans("MAIN_MAIL_SMTPS_PW").' | '.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW).' |
| '.$langs->trans("MAIN_MAIL_EMAIL_TLS").' | '; - if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) - { - if (function_exists('openssl_open')) + // Host server + if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail')) { - print yn($conf->global->MAIN_MAIL_EMAIL_TLS); - } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } else print ''.yn(0).' ('.$langs->trans("NotSupported").')'; - print ' |
| '.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").' | '.$langs->trans("SeeLocalSendMailSetup").' |
| '.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).' | '.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').' |
| '.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").' | '; - if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) - { - if (function_exists('openssl_open')) + // Port + if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail')) { - print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS); - } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } else print ''.yn(0).' ('.$langs->trans("NotSupported").')'; - print ' |
| '.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").' | '.$langs->trans("SeeLocalSendMailSetup").' |
| '.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).' | '.(!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '').' |
| '.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").' | '; - if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) - { - if (function_exists('openssl_open')) + // SMTPS ID + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { - print yn($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED); - } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } else print ''.yn(0).' ('.$langs->trans("NotSupported").')'; - print ' |
| '.$langs->trans("MAIN_MAIL_SMTPS_ID").' | '.$conf->global->MAIN_MAIL_SMTPS_ID.' |
| '.$langs->trans("MAIN_MAIL_SMTPS_PW").' | '.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW).' |
| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").' | '; - if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))) + // TLS + print ' |
| '.$langs->trans("MAIN_MAIL_EMAIL_TLS").' | '; + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print yn($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED); + print yn($conf->global->MAIN_MAIL_EMAIL_TLS); } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } else print yn(0).' ('.$langs->trans("NotSupported").')'; + } else print ''.yn(0).' ('.$langs->trans("NotSupported").')'; print ' |
| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").' | '; - print ''.$conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN; - print ' |
| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").' | '; - print ''.$conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR; - print ' |
| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").' | '; - print ''.$conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY; - print ' |
| '.$langs->trans("OtherOptions").' | |
| '.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' | '; - print ''.$conf->global->MAIN_MAIL_EMAIL_FROM; - if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && !isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail")); - print ' |
| '.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").' | '; + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { - $obj = $db->fetch_object($resql); - if ($obj) + if (function_exists('openssl_open')) { - $liste['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>'; - } - $i++; - } - } else dol_print_error($db); + print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS); + } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; + } else print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + print ' |
| '.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').' | '; - print ''; - if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'robot') - { - print $langs->trans('RobotEmail'); - } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user') - { - print $langs->trans('UserEmail'); - } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company') - { - print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>'); - } else { - $id = preg_replace('/senderprofile_/', '', $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE); - if ($id > 0) + // SMTP_ALLOW_SELF_SIGNED + print ' |
| '.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").' | '; + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { - include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php'; - $emailsenderprofile = new EmailSenderProfile($db); - $emailsenderprofile->fetch($id); - print $emailsenderprofile->label.' '.dol_escape_htmltag('<'.$emailsenderprofile->email.'>'); + if (function_exists('openssl_open')) + { + print yn($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED); + } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; + } else print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + print ' |
| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").' | '; + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))) + { + if (function_exists('openssl_open')) + { + print yn($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED); + } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; + } else print yn(0).' ('.$langs->trans("NotSupported").')'; + print ' |
| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").' | '; + print ''.$conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN; + print ' |
| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").' | '; + print ''.$conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR; + print ' |
| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").' | '; + print ''.$conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY; + print ' |
| '.$langs->trans("OtherOptions").' | |
| '.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' | '; + print ''.$conf->global->MAIN_MAIL_EMAIL_FROM; + if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && !isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail")); + print ' |
| '.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').' | '; + print ''; + if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'robot') + { + print $langs->trans('RobotEmail'); + } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user') + { + print $langs->trans('UserEmail'); + } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company') + { + print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>'); + } else { + $id = preg_replace('/senderprofile_/', '', $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE); + if ($id > 0) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php'; + $emailsenderprofile = new EmailSenderProfile($db); + $emailsenderprofile->fetch($id); + print $emailsenderprofile->label.' '.dol_escape_htmltag('<'.$emailsenderprofile->email.'>'); + } + } + print ' |
| '.$langs->trans("MAIN_MAIL_ERRORS_TO").' | '; + print ''.$conf->global->MAIN_MAIL_ERRORS_TO; + if (!empty($conf->global->MAIN_MAIL_ERRORS_TO) && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) print img_warning($langs->trans("ErrorBadEMail")); + print ' |
| '.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").' | '; + print ''; + if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) + { + print $conf->global->MAIN_MAIL_AUTOCOPY_TO; + if (!isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail")); + } else { + print ' '; + } + print ' |
| '.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").' | '.yn($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT).' |
| '; + $boxstat .= ' | ';
$boxstat .= ' '.$langs->trans("DolibarrStateBoard").' ';
$boxstat .= ' | ';
$boxstat .= '