diff --git a/phpBB/includes/emailer.php b/phpBB/includes/emailer.php index 2182ea6a8c..3d212629bd 100755 --- a/phpBB/includes/emailer.php +++ b/phpBB/includes/emailer.php @@ -141,7 +141,7 @@ class emailer // Send the mail out to the recipients set previously in var $this->address function send() { - global $board_config, $lang, $phpEx, $phpbb_root_path; + global $board_config, $lang, $phpEx, $phpbb_root_path, $db; // Escape all quotes, else the eval will fail. $this->msg = str_replace ("'", "\'", $this->msg); @@ -207,7 +207,8 @@ class emailer // Build header $this->extra_headers = (($this->replyto != '') ? "Reply-to: <$this->replyto>\n" : '') . (($this->from != '') ? "From: <$this->from>\n" : "From: <" . $board_config['board_email'] . ">\n") . "Return-Path: <" . $board_config['board_email'] . ">\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . gmdate('D, d M Y H:i:s Z', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" . (($cc != '') ? "Cc:$cc\n" : '') . (($bcc != '') ? "Bcc:$bcc\n" : '') . trim($this->extra_headers); - $to = ($to == '') ? "undisclosed-recipients:;" : $to; + $empty_to_header = ($to == '') ? TRUE : FALSE; + $to = ($to == '') ? (($board_config['sendmail_fix'] && !$this->use_smtp) ? ' ' : 'Undisclosed-recipients:;') : $to; // Send message ... removed $this->encode() from subject for time being if ( $this->use_smtp ) @@ -222,6 +223,22 @@ class emailer else { $result = @mail($to, $this->subject, preg_replace("#(?msg), $this->extra_headers); + + if (!$result && !$board_config['sendmail_fix'] && $empty_to_header) + { + $to = ' '; + + $sql = "UPDATE " . CONFIG_TABLE . " + SET config_value = '1' + WHERE config_name = 'sendmail_fix'"; + if (!$db->sql_query($sql)) + { + message_die(GENERAL_ERROR, 'Unable to update config table', '', __LINE__, __FILE__, $sql); + } + + $board_config['sendmail_fix'] = 1; + $result = @mail($to, $this->subject, preg_replace("#(?msg), $this->extra_headers); + } } // Did it work? diff --git a/phpBB/install/schemas/ms_access_primer.zip b/phpBB/install/schemas/ms_access_primer.zip index f8a416a96d..a8528dee29 100644 Binary files a/phpBB/install/schemas/ms_access_primer.zip and b/phpBB/install/schemas/ms_access_primer.zip differ diff --git a/phpBB/install/schemas/mssql_basic.sql b/phpBB/install/schemas/mssql_basic.sql index 273bfd4718..39b286fea8 100644 --- a/phpBB/install/schemas/mssql_basic.sql +++ b/phpBB/install/schemas/mssql_basic.sql @@ -46,6 +46,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0' INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host',''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username',''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('sendmail_fix','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0'); diff --git a/phpBB/install/schemas/mysql_basic.sql b/phpBB/install/schemas/mysql_basic.sql index fa8e1a0892..64dfc2e7cf 100644 --- a/phpBB/install/schemas/mysql_basic.sql +++ b/phpBB/install/schemas/mysql_basic.sql @@ -39,6 +39,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0' INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host',''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username',''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('sendmail_fix','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0'); diff --git a/phpBB/install/schemas/postgres_basic.sql b/phpBB/install/schemas/postgres_basic.sql index d58f352da7..de36aa8a05 100644 --- a/phpBB/install/schemas/postgres_basic.sql +++ b/phpBB/install/schemas/postgres_basic.sql @@ -40,6 +40,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0' INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host',''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username',''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('sendmail_fix','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0'); diff --git a/phpBB/install/update_to_205.php b/phpBB/install/update_to_205.php index 382ac2e24b..8facfb378e 100644 --- a/phpBB/install/update_to_205.php +++ b/phpBB/install/update_to_205.php @@ -875,6 +875,10 @@ switch ($row['config_value']) VALUES ('enable_confirm', '0')"; _sql($sql, $errored, $error_ary); + $sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) + VALUES ('sendmail_fix', '0')"; + _sql($sql, $errored, $error_ary); + break; default: