diff --git a/inc/Mailer.class.php b/inc/Mailer.class.php index eb44583b9..dd6cbd3eb 100644 --- a/inc/Mailer.class.php +++ b/inc/Mailer.class.php @@ -696,6 +696,7 @@ class Mailer { * @return bool true if the mail was successfully passed to the MTA */ public function send() { + global $lang; $success = false; // prepare hook data @@ -754,6 +755,14 @@ class Mailer { $headers .= MAILHEADER_EOL.trim($data['headers']); } + if(!function_exists('mail')){ + $emsg = $lang['email_fail'] . $subject; + error_log($emsg); + msg(hsc($emsg), -1, __LINE__, __FILE__, MSG_MANAGERS_ONLY); + $evt->advise_after(); + return false; + } + // send the thing if($this->sendparam === null) { $success = @mail($to, $subject, $body, $headers); diff --git a/inc/compatibility.php b/inc/compatibility.php index cb865a2d7..445f2456b 100644 --- a/inc/compatibility.php +++ b/inc/compatibility.php @@ -79,4 +79,5 @@ if(!function_exists('gztell') && function_exists('gztell64')) { function gztell($zp) { return gztell64($zp); } -} \ No newline at end of file +} + diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php index 4054269a8..eb3ad1638 100644 --- a/inc/lang/en/lang.php +++ b/inc/lang/en/lang.php @@ -319,6 +319,9 @@ $lang['i_modified'] = 'For security reasons this script will only wor You should either re-extract the files from the downloaded package or consult the complete Dokuwiki installation instructions'; $lang['i_funcna'] = 'PHP function %s is not available. Maybe your hosting provider disabled it for some reason?'; +$lang['i_disabled'] = 'It has been disabled by your provider.'; +$lang['i_funcnmail'] = 'Note: The PHP mail function is not available. %s' . + ' If it remains unavailable, you may install the smtp plugin.'; $lang['i_phpver'] = 'Your PHP version %s is lower than the needed %s. You need to upgrade your PHP install.'; $lang['i_mbfuncoverload'] = 'mbstring.func_overload must be disabled in php.ini to run DokuWiki.'; $lang['i_urandom'] = 'DokuWiki cannot create cryptographically secure numbers for cookies. You may want to check your open_basedir settings in php.ini for proper /dev/urandom access.'; @@ -378,6 +381,7 @@ $lang['media_update'] = 'Upload new version'; $lang['media_restore'] = 'Restore this version'; $lang['media_acl_warning'] = 'This list might not be complete due to ACL restrictions and hidden pages.'; +$lang['email_fail'] = 'PHP mail() missing or disabled. The following email was not sent: '; $lang['currentns'] = 'Current namespace'; $lang['searchresult'] = 'Search Result'; $lang['plainhtml'] = 'Plain HTML'; diff --git a/install.php b/install.php index 253cd3550..3b05267e7 100644 --- a/install.php +++ b/install.php @@ -581,7 +581,7 @@ function check_functions(){ $funcs = explode(' ','addslashes call_user_func chmod copy fgets '. 'file file_exists fseek flush filesize ftell fopen '. - 'glob header ignore_user_abort ini_get mail mkdir '. + 'glob header ignore_user_abort ini_get mkdir '. 'ob_start opendir parse_ini_file readfile realpath '. 'rename rmdir serialize session_start unlink usleep '. 'preg_replace file_get_contents htmlspecialchars_decode '. @@ -592,6 +592,16 @@ function check_functions(){ $funcs[] = 'utf8_decode'; } + if(!function_exists('mail')){ + if(strpos(ini_get('disable_functions'),'mail') !== false) { + $disabled = $lang['i_disabled']; + } + else { + $disabled = ""; + } + $error[] = sprintf($lang['i_funcnmail'],$disabled); + } + foreach($funcs as $func){ if(!function_exists($func)){ $error[] = sprintf($lang['i_funcna'],$func);