Better error/setup messages.
This commit is contained in:
parent
460c926f98
commit
936c46d219
@ -230,7 +230,6 @@ $linuxlike=1;
|
||||
if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
|
||||
if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0;
|
||||
|
||||
|
||||
if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail';
|
||||
$port=! empty($conf->global->MAIN_MAIL_SMTP_PORT)?$conf->global->MAIN_MAIL_SMTP_PORT:ini_get('smtp_port');
|
||||
if (! $port) $port=25;
|
||||
@ -275,8 +274,21 @@ if ($action == 'edit')
|
||||
';
|
||||
if ($linuxlike)
|
||||
{
|
||||
print ' jQuery("#MAIN_MAIL_SMTP_SERVER").prop("disabled", true);';
|
||||
print ' jQuery("#MAIN_MAIL_SMTP_PORT").prop("disabled", true);';
|
||||
print '
|
||||
jQuery("#MAIN_MAIL_SMTP_SERVER").hide();
|
||||
jQuery("#MAIN_MAIL_SMTP_PORT").hide();
|
||||
jQuery("#smtp_server_mess").show();
|
||||
jQuery("#smtp_port_mess").show();
|
||||
';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '
|
||||
jQuery("#MAIN_MAIL_SMTP_SERVER").prop("disabled", true);
|
||||
jQuery("#MAIN_MAIL_SMTP_PORT").prop("disabled", true);
|
||||
jQuery("#smtp_server_mess").hide();
|
||||
jQuery("#smtp_port_mess").hide();
|
||||
';
|
||||
}
|
||||
print '
|
||||
}
|
||||
@ -287,7 +299,11 @@ if ($action == 'edit')
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr("disabled");
|
||||
jQuery("#MAIN_MAIL_SMTP_SERVER").removeAttr("disabled");
|
||||
jQuery("#MAIN_MAIL_SMTP_PORT").removeAttr("disabled");
|
||||
}
|
||||
jQuery("#MAIN_MAIL_SMTP_SERVER").show();
|
||||
jQuery("#MAIN_MAIL_SMTP_PORT").show();
|
||||
jQuery("#smtp_server_mess").hide();
|
||||
jQuery("#smtp_port_mess").hide();
|
||||
}
|
||||
}
|
||||
initfields();
|
||||
jQuery("#MAIN_MAIL_SENDMODE").change(function() {
|
||||
@ -336,7 +352,7 @@ if ($action == 'edit')
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Server
|
||||
// Host server
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
if (! $conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||
@ -357,6 +373,7 @@ if ($action == 'edit')
|
||||
{
|
||||
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="' . $mainserver . '">';
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="' . $mainserver . '">';
|
||||
print '<span id="smtp_server_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -389,6 +406,7 @@ if ($action == 'edit')
|
||||
{
|
||||
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" size="3" value="' . $mainport . '">';
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_sav" name="MAIN_MAIL_SMTP_PORT_sav" value="' . $mainport . '">';
|
||||
print '<span id="smtp_port_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -509,7 +527,7 @@ else
|
||||
print $text;
|
||||
print '</td></tr>';
|
||||
|
||||
// Server
|
||||
// Host server
|
||||
$var=!$var;
|
||||
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail'))
|
||||
{
|
||||
|
||||
@ -39,7 +39,7 @@ class CMailFile
|
||||
var $subject; // Topic: Subject of email
|
||||
var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>')
|
||||
// Sender: Who send the email ("Sender" has sent emails on behalf of "From").
|
||||
// Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, use for Sender an email of the protected domain.
|
||||
// Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, add Sender field with an email of the protected domain.
|
||||
// Return-Path: Email where to send bounds.
|
||||
var $errors_to; // Errors-To: Email where to send errors.
|
||||
var $addr_to;
|
||||
@ -408,8 +408,8 @@ class CMailFile
|
||||
$bounce = ''; // By default
|
||||
if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F))
|
||||
{
|
||||
// le return-path dans les header ne fonctionne pas avec tous les MTA
|
||||
// Le passage par -f est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie.
|
||||
// le "Return-Path" (retour des messages bounced) dans les header ne fonctionne pas avec tous les MTA
|
||||
// Le forcage de la valeure grace à l'option -f de sendmail est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie.
|
||||
// La variable definie pose des pb avec certains sendmail securisee (option -f refusee car dangereuse)
|
||||
$bounce .= ($bounce?' ':'').(! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f' . $this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO,2) : ($this->addr_from != '' ? '-f' . $this->getValidAddress($this->addr_from,2) : '') );
|
||||
}
|
||||
@ -427,7 +427,15 @@ class CMailFile
|
||||
|
||||
if (! $res)
|
||||
{
|
||||
$this->error="Failed to send mail with php mail to HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port')."<br>Check your server logs and your firewalls setup";
|
||||
$this->error="Failed to send mail with php mail";
|
||||
$linuxlike=1;
|
||||
if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
|
||||
if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0;
|
||||
if (! $linuxlike)
|
||||
{
|
||||
$this->error.=" to HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'); // This values are value used only for non linuxlike systems
|
||||
}
|
||||
$this->error.=".<br>Check your server logs and your firewalls setup";
|
||||
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
||||
}
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user