Skip to:
Content
Pages
Categories
Search
Top
Bottom

trick to fix some email problems with 0.8.x plugins on 0.9.x

  • @_ck_

    Participant

    bbPress 0.9 renamed the critical system email address that several plugins rely on (“admin_email” became “from_email”)

    Unfortunately many plugin authors aren’t aware of this and the old setting is completely deleted from the database, which makes any older plugin that looks for “admin_email” fail and get a blank address and don’t anticipate/test for a blank. So they blindly insert the blank address into emails which causes the emailer to either fail or bounce the message.

    A few of my plugins were affected, I just found another tonight, and there are several third-party ones still unpatched.

    You can work around this problem by putting this into your bb-config.php (anywhere on a new line)

    $bb->admin_email = 'email@your-forum.com';

    where email@your-forum.com is the same email address you use inside bbPress on bb-admin/options-general.php

    This won’t hurt anything, causes no extra load of any kind and simply allows older plugins to work without additional edits until the authors get a chance to upgrade them.

    (Just remember you “hard coded” this address if you ever change the main one for any reason. You can delete it after 1.0 is out and all plugins have upgraded. In fact the old email address will become unused after all the plugin upgrade anyway so this can’t hurt anything in practice.)

Viewing 2 replies - 1 through 2 (of 2 total)
  • @howtogeek

    Member

    I wrote my own replacement plugin for the mail function that uses the Swift Mailer PHP class to call sendmail directly, which should provide better performance over the built-in php mail functions.

    It also gives the the chance to assign a display name to the email address so it comes through as “bbPress Support Forum” instead of just “forum@bbpress.org”.

    if ( !function_exists('bb_mail') ) {
    function bb_mail($to, $subject, $content, $headers=''){

    require_once('PATH_TO/Swift/lib/Swift.php');
    require_once('PATH_TO/Swift/lib/Swift/Connection/Sendmail.php');

    $swift =& new Swift(new Swift_Connection_Sendmail("/usr/sbin/sendmail -bs"));
    $from = new Swift_Address("noreply@mysite.com","My bbPress Forums");

    $message =& new Swift_Message($subject, $content);
    if ($swift->send($message, $to, $from)) {return true;}
    else{ echo "Message failed to send to ".$to." from ".$from;}
    $swift->disconnect();
    }
    }

    To use this, you’d have to download Swift from their site and put it where it’s included in the above code.

    http://www.swiftmailer.org/

    You could also modify it to connect to an external SMTP server (even the Gmail server, for instance) by changing the Swift_Connection part above using this guide:

    http://www.swiftmailer.org/wikidocs/v3/connections/smtp

    Does this plugin available? I hope you may also include Swift Mailer. I can not put my bbpress on due to this problem. I’m just using a free hosting. Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar