/** * Starts the process of sending an email - either immediately or by adding it to the mail queue. * * @param string Destination email address * @param string Email message subject * @param string Email message body * @param boolean If true, do not use the mail queue and send immediately * @param string Optional name/email to use in 'From' header * @param string Additional headers * @param string Username of person sending the email */ function vbmail($toemail, $subject, $message, $notsubscription = false, $from = '', $uheaders = '', $username = '') { if (empty($toemail)) { return false; } if (defined('DISABLE_MAIL')) { // define this in config.php -- good for test boards, // that you don't want people to stumble upon if (is_string(DISABLE_MAIL) and strpos(DISABLE_MAIL, '@') !== false) { // DISABLE_MAIL contains part of an email address, // so only let emails matching that through if (strpos($toemail, DISABLE_MAIL) === false) { return true; // email not matched } } else { return true; // all mail disabled } } global $vbulletin; if (!class_exists('vB_Mail', false)) { require_once DIR . '/includes/class_mail.php'; } if ($vbulletin->options['usemailqueue'] and !$notsubscription) { $mail = vB_QueueMail::fetch_instance(); } else { if ($vbulletin->options['use_smtp']) { $mail = new vB_SmtpMail($vbulletin); } else { $mail = new vB_Mail($vbulletin); } } if (!$mail->start($toemail, $subject, $message, $from, $uheaders, $username)) { return false; } return $mail->send(); }
$mail = new vB_SmtpMail($vbulletin); } else { $mail = new vB_Mail($vbulletin); } $mail->set_debug(true); $mail->start($emailaddress, $subject, $message, $vbulletin->options['webmasteremail']); // error handling @ini_set('display_errors', true); if (strpos(@ini_get('disable_functions'), 'ob_start') !== false) { // alternate method in case OB is disabled; probably not as fool proof @ini_set('track_errors', true); $oldlevel = error_reporting(0); } else { ob_start(); } $mailreturn = $mail->send(); if (strpos(@ini_get('disable_functions'), 'ob_start') !== false) { error_reporting($oldlevel); $errors = $php_errormsg; } else { $errors = ob_get_contents(); ob_end_clean(); } // end error handling if (!$mailreturn or $errors) { $results = array(); if (!$mailreturn) { $results[] = $vbphrase['mail_function_returned_error']; } if ($errors) { $results[] = $vbphrase['mail_function_errors_returned_were'] . '<br /><br />' . $errors;