Release Notes

  • Works with invitefriends plugin (thanks to jgallardo)
  • Fixed typo in sending code that affected alternate mail bodies (thanks to Jin Peng)
  • This is an very valuable plugin.

    To also use it for test purposes, we have added a little piece of code in the plugin settings and in mail.php. In that way we can use the same database as the production site, without ever running the risk that the test site delivers test emails to real users:

     

    in mail.php:

        //*** MOD add after line 44 in mail.php
        $to_over = get_plugin_setting('phpmailer_to_override', 'phpmailer');
        if ($to_over) {
            // we have an override address
            $override = true;
            $adr_exception = get_plugin_setting('phpmailer_to_override_except', 'phpmailer');
            if ($adr_exception) {
                if (strpos($adr_exception, $to) > -1) {
                    $override = false;
                }
            }
            if ($override) {
                // not in exception string, so we can override
                $subject.=" (redirect from: $to )";
                $to = $to_over;
            }
        }
        // ** END MOD

     

    in settings/../edit.php

    // ****** BEGIN MOD after line 45


        // Override, if we want ALL emails to go to one Address and never to another !

        $phpmailer_to_override = $vars['entity']->phpmailer_to_override; // setting added to allow override for ALL emails
        echo '<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . elgg_echo('phpmailer:to_override') . ':&nbsp;&nbsp;';
        echo elgg_view('input/text', array(
            'internalname' => 'params[phpmailer_to_override]',
            'value' => $phpmailer_to_override,
            'class' => ' '
                ));
        echo '</p>';


        // ....Override ... unless address is mentioned in this comma seperated string, so for example list email addresses of all developers working on the code

        $phpmailer_to_override_except = $vars['entity']->phpmailer_to_override_except; // setting added by TVld to allow override for ALL emails
        echo '<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . elgg_echo('phpmailer:to_override_except');
        echo '</br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . elgg_view('input/text', array(
            'internalname' => 'params[phpmailer_to_override_except]',
            'value' => $phpmailer_to_override_except,
                ));
        echo '</p>';
        // ****** END MOD



     

  • I also have a plugin just for redirecting email when testing: link

  • @Cash: after testing this one we realized the addition is so minimal compared to yet another plugin (how many is reasonable?  we have over 75 now) that we could not resist...

  • @Tom - for many users editing the code of a plugin can cause problems that's why I recommend a self-contained plugin for that purpose.

  • @Cash: yes, I u. And we are no favor of it... was hoping between the lines you would think it worthwhile to take the suggestion in ;)

    The whole thing comes from the question if many (many) plugins would slow down the site, or that there is no penalty and it is indeed good idea to spread functions wide. But off topic here...

  • I've read the readme, and I've input my settings, but I'm still getting this in my error log whenever notifications attemps to send email through smtp.

    [22-Feb-2011 15:26:53] PHP WARNING: 2011-02-22 15:26:53 (MST): "PHPMailer error: SMTP Error: The following recipients failed: xxxxx@xxxxxx.com" in file /xxxx/xxxx/public_html/elgg.folder/mod/phpmailer/mail.php (line 139)

    My hosting company (bluehost.com) generally requires port 26 for SMTP (i.e. this works in SugarCRM), but I can't find a way to override the default port in the admin panel (except for the SSL port). I took a crack at hacking the source and chaned the default port to 26 (in class.phpmailer.php, class.smtp.php), I also tried adding [$phpmailer->Port = 26] on line 125 of mail.php. But it didn't work, so I changed everything back. Now I'm stuck.

    Any ideas? Thanks in advance- Darryl

  • @Darryl - if you're not using using authentication for sending mail, you'll want the $phpmailer->Port line up around line 120 of mail.php.

  • disculpen e instalado el plugin e ingresado los datos de mi cuenta gmail pero no envia los correos al mail de los usuarion y tampoco llega la activacion, estoy usando elgg en mi pc de servidor pero nada los correos jamas llegan alguna ayuda por favor. en el archivo class.phpmailer.php hay que configurar algo ?

  • apologize and installed the plugin and entered the data from my gmail account but notsend emails to mail the usuarion and neither does the activation, I'm using elgg server inmy pc but no emails ever get some help please. class.phpmailer.php the file must beconfigured something?

  • @Cash - Thanks for the reply.

    I am using authentication, but that may be a better place to set the port in any case.

    But alas... that didn't work either... at least not without some extra homework. I added a print_r($phpmailer); die(); in the if ( ! return){} block to see exactly what the class was sending.

    I fired up a telnet session to the mail server to mimic the class and discovered that I had set a no-reply@domain.com address in site administration (and by extension the <From> header) and the mail server was refusing to continue because it was not a valid mail account.

    I created the no-reply account, and now it is sending fine. Thank you for your patience.

  • apologize and installed the plugin and entered the data from my gmail account but notsend emails to mail the usuarion and neither does the activation, I'm using elgg server inmy pc but no emails ever get some help please.

    class.phpmailer.php the file must beconfigured something?

  • tengo alojado elgg en mi servidor local por lo cual no uso un servidor smtp ya que estoy usando este plugin bien en el panel de administracion pongo todo los dato de mi cuenta gmail pero no llegan los mail e activado todo desde gmail pero nada ya no me ocurre nada alguien trate de registrarse en mi pagina y probar si le llega el correo de activacion http://floops.dyndns.org

  • I installed this plugin a lot earlier. It was working fine. One day, I just deleted the folder of PHPMailer accidently. Then I uploaded the files of this plugin. Now it is now working. The email which is supposed to be sent is not appearing in the inbox, nor in spam folder. Please help me with this.

     

  • Cash

    Thanks for your plugin, I can now validate new users by email on WAMP, however if I try to invite friends in the friends plugin by specifying email addresses looks like the override with new PHPMailer is not called. Any pointers?

     

  • I was able to fix the invite friends plugin to use the PHPMailer by changing to following code in mod/invitefriends/actions/invite.php

        // BUG: Invite friends does not use PHPMailer
            // mail($email, $subject, wordwrap($message), $headers);
            if(is_plugin_enabled("phpmailer")){
                phpmailer_send($from, $sitename, $email, "", $subject, wordwrap($message));
            }
            else {
                mail($email, $subject, wordwrap($message), $headers);
            }

    However if I compare this with user registration looks like the difference is in how email notificaitons are handled. Am I on the right track. The release notes say that version 0.9.9 works with invitefriends, but without my changes as above I cannot get it to work. I am running elgg 1.7.1

  • this is a cool fix ;- )

    notifications ? you;l have to locate the code inside there that does the email send..

  • I figured the code inside the invitefriends plugin to use PHPMailer.

    However I wanted to make sure that I have a good understanding why PHPMailer worked for user registration, I think it is because in PHPEmailer start.php we override the email notification handler

    register_notification_handler("email", "phpmailer_notify_handler"); this bypasses the default handler in notification.php.

    If someone can confirm my understanding that will be great.

  • this plugins don't send mails

    Help me please!

  • @Jean Paul - you must provide some information.

  • I installed this plugin on Elgg Elgg 1.7.6 and 1.7.7 without success.
    These are the data from my SMTP server:

    Host: Mail.chilemail.org

    User: pagos@chilemail.org

    Password: 9xxxxxx

    SSL port: 25

     

    This plugin and Elgg was tested on different servers.

  • @ Cash, sir is ti possible to add cron to this pluggin.

    can I add register_plugin_hook('cron', 'fiveminute', 'phpmailer_send'); for cron

    after that how to set the limits of the mail to be send? in 5 min 100 emails? please help

  • @Thuvalpakshi - this is not a notification cron job plugin. Kevin Jardine wrote one that you might want to take a look at.

  • Hi Im new to this ...how can I config the plugin? What would be an example of the settings filled for this to work?

  • @cynthia - you would get the settings from your hosting provider (smtp settings). Good luck.

Stats

  • Category: Communication
  • License: GNU General Public License (GPL) version 2
  • Updated: 2014-11-17
  • Downloads: 17751
  • Recommendations: 33

Other Projects

View Cash's plugins