Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: EMAIL WON’T SEND, FROM ANYHTING


Sam Bauers
Participant

@sambauers

Put this in a plugin file and activate it. It’s a drop-in replacement for bb_mail() from the current trunk

<?php
/*
Plugin Name: Fix bb_mail function
Plugin URI:
Description: Temporary replacement for bb_mail() function
Author: Sam Bauers
Author URI:
Version: 0.0.1
*/

if ( !function_exists( 'bb_mail' ) ) :
function bb_mail( $to, $subject, $message, $headers = '' ) {
if (!is_array($headers)) {
$headers = trim($headers);
$headers = preg_split('@r(?:n{0,1})|n@', $headers);
}

if (!count($headers) || !count(preg_grep('/^from:s/im', $headers))) {
$from = parse_url(bb_get_option('uri'));
if ($from && $from['host']) {
$from = trim(preg_replace('/^www./i', '', $from['host']));
$headers[] = 'From: "' . bb_get_option('name') . '" <bbpress@' . $from . '>';
}
}
$headers = trim(join("rn", $headers));

return @mail($to, $subject, $message, $headers);
}
endif;
?>

Skip to toolbar