We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22303 MODX Staff
    • 10,725 Posts
    First of all, you do not need PHPMailer to solve this. All you need is to add the charset header to the existing mail() calls. Second, the web user password reminder is part of the weblogin snippet (see /assets/snippets/weblogin/*).
      • 21496
      • 225 Posts
      Quote from: mcclausky at Nov 19, 2007, 03:46 PM

      I also tested the manager password reminder. The headers arrive like this:

      Content-type: text/html; charset=iso-8859-1
      X-Mailer: PHP/4.4.7

      but... the special chars are garbled. I noticed that in this case, the email text is obtained from manager\includes\lang\spanish.inc.php. I checked this file and everything is ok, specials chars look fine, and the file is UTF-8.

      I don’t know what’s wrong huh


      Ok, it seems there are so many possibilities. Please do the following: Create a new manager user (so you can test safely without messing anything). Then check "New password" and for password notification method, chose "Send the new password by e-mail". The messages sent out are configured in Configuration > User > Sign Up e-mail. Use your special characters there. What’s the result?
        René
        • 21496
        • 225 Posts
        Quote from: OpenGeek at Nov 19, 2007, 03:51 PM

        First of all, you do not need PHPMailer to solve this. All you need is to add the charset header to the existing mail() calls. Second, the web user password reminder is part of the weblogin snippet (see /assets/snippets/weblogin/*).

        Okay, it seems part of the confusion was that Mcclausky and I didn’t talk exactly about the same thing.

        But my point of going into all of this is that PHPMailer is adding the correct headers automatically. So since this class is part of the default installation, it’s a maintenance nightmare if every snippet is using it’s own mail() calls instead of making use of this class.

        And I’m not even talking about snippets that much here, I’m talking about the manager functions that are sending out mails. Why not making it more friendly for international users by default? The way it is now, I have to go and add the headers to the mail() calls in several files, and I have to keep track of those changes in case of an update.

        So to me, using PHPMailer has only advantages and is reasonable, even for those not using international characters, as it’s less likely those mails are trapped in spam filters for not having complete headers. Well, I’m not a developer, so I may overlook something. But then I would like to know what speaks against PHPMailer and for customized scattered mail() calls in different files.
          René
          • 22303 MODX Staff
          • 10,725 Posts
          I completely agree with your assessment of the issue, but, that’s the current reality; mail() calls scattered throughout the core and various existing add-ons. Absolutely nothing speaks against using PHPMailer; I just said it wasn’t necessary to solve your issue, since you were forced to "hack the core" anyway.

          The 0.9.7 release features a MODx mail API and a default implementation of this API using the lastest release of PHPMailer. It will also allow development of alternative implementations, e.g. using SwiftMailer or a custom mailer engine, without changing the API developers would use throughout the MODx core, core-extensions, or any kind of add-on to actually send email.

          In the meantime, if someone wants to provide a patch or develop a solution for 0.9.6.x which will address this, I certainly encourage it, and will be glad to consider adding you to the team so you have SVN commit privileges, should you prefer that approach. Unfortunately, I personally am no longer committing significant time directly to the 0.9.6.x code, in an effort to stay focused on delivering 0.9.7, though I would of course be willing to guide/advise on such a solution. I just need the community to step up with contributions to fill the gap.
            • 21496
            • 225 Posts
            Thanks Jason for the clarification. I understand you’re busy with the 0.9.7 release and I’m glad this version will take care of those issues. If it still makes sense to add patches like mine to the SVN repository for 0.9.6.1, then I’m willing to commit to this. Actually I didn’t know whom to address exactly with those issues.
              René
              • 4971
              • 964 Posts
              Is PHPMailer better than SwiftMailer?
                Website: www.mercologia.com
                MODX Revo Tutorials:  www.modxperience.com

                MODX Professional Partner
                • 21496
                • 225 Posts
                Quote from: charliez at Nov 19, 2007, 08:17 PM

                Is PHPMailer better than SwiftMailer?

                To start that discussion is opening a can of worms. Given the choice, personally I would probably go for SwiftMailer. But others will vote for PHPMailer. For the needs within my projects, both will do equally fine.
                  René
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Swift!! grin

                  Can we go fishing? I haven’t been fishing for 20 years!
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 22303 MODX Staff
                    • 10,725 Posts
                    And here’s the first worm, as promised...

                    In all fairness, Swift is a much better written piece of software, but it’s overkill for what is needed in the core of MODx. This is precisely why I chose to create a generic MODx API to abstract any direct calls to PHPMailer functions, SwiftMailer functions, or plain old mail(), without limiting access to more advanced functions from whichever mailer you may prefer to use for your add-ons that need to. As an example from 0.9.7 code...
                    <?php
                    // This line gets an instance of the configured mailer implementation 
                    // and adds it to the $modx object, similar to 0.9.6.x extenders (hint, hint)
                    $modx->getService('mail', $modx->config['mail.className']);
                    
                    // Set some attributes common to any mailer
                    $modx->mail->set(MODX_MAIL_SUBJECT, 'My Email Subject');
                    $modx->mail->set(MODX_MAIL_FROM, '[email protected]');
                    $modx->mail->set(MODX_MAIL_BODY, 'This is a message.');
                    
                    // Set addresses
                    $modx->mail->address('to', '[email protected]', 'Full Name');
                    $modx->mail->address('reply-to', '[email protected]', 'Full Name');
                    
                    // Set some custom headers (maybe?)
                    $modx->mail->header('X-Mailer: modMail prototype');
                    
                    // And send it...
                    $modx->mail->send();
                    ?>

                    This code could load whatever derivative class of modMail you wanted, via system settings, or a parameter. That class would be responsible for implementing the modMail function calls using the mailer engine you wanted, and you could still get access to the mailer directly via $mail->mailer->PHPMailerSpecificFunction().

                    You can see the beginning of this implemented for 0.9.7 at http://svn.modxcms.com/svn/tattoo/tattoo/branches/0.9.7/core/model/modx/mail/. It still needs some work, and I need to make sure Swift will work well with this before I set the API in stone, but it might make a good extender ($modx->mail) for the 0.9.6.x branch; that way component developers for 0.9.6.x and 0.9.7 have one less things to migrate.
                      • 21496
                      • 225 Posts
                      Quote from: sottwell at Nov 19, 2007, 11:01 PM

                      Swift!! grin

                      Can we go fishing? I haven’t been fishing for 20 years!

                      Good idea Susan, let’s take all the worms we need out of that can, let’s go fishing, and then have a Sushi and Sashimi party! grin
                        René