We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17016
    • 138 Posts
    In our system modPHPMailer doesn´t work. Are there any important values to be set in the System Settings? For example do we have to activate SMTP Authentification to make it work?

    The PHPMailer-Version on our server is 2.0.4 if this is a important fact...

    Thanks a lot in advance!
    Letti
      • 17016
      • 138 Posts
      The error we get when using modPHPMailer:

      (ERROR @ /index.php) An error occurred while trying to send the email:

      Any idea what could be the reason for this?

      The snippet we use:
      <?php
      $message = 'Hello';
       
      $modx->getService('mail', 'mail.modPHPMailer');
      $modx->mail->set(modMail::MAIL_BODY,$message);
      $modx->mail->set(modMail::MAIL_FROM,'[email protected]');
      $modx->mail->set(modMail::MAIL_FROM_NAME,'MyDomain');
      $modx->mail->set(modMail::MAIL_SENDER,'MyDomain');
      $modx->mail->set(modMail::MAIL_SUBJECT,'New User Signed Up');
      $modx->mail->address('to','[email protected]');
      $modx->mail->setHTML(true);
      if (!$modx->mail->send()) {
          $modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$err);
      }
      $modx->mail->reset();
      /* tell our snippet we're good and can continue */
      return true;
        • 3749
        • 24,544 Posts
        Your host could have the mail() function turned off (many do), or if you’re using something like XAMPP on your own machine, there’s no mail server installed. You could try the QuickEmail snippet to see if it gives you any more information (set &debug=`1`).

        Usually, the easiest solution is to use SMTP.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting