We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39535
    • 39 Posts
    Well, I see a lot of time has passed since the last post in this thread.
    I got there when googling for the same issue ('Could not instantiate mail function' in error log) but now for MODX Revo's FormIt this time. As I see both cases have the same source of problem. So I will write here solution that worked for me.

    As it was mentioned above formit also uses phpmailer class (/core/model/modx/mail/phpmailer/class.phpmailer.php)
    The problem was with $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
    (line 482). With $params variable. I just removed it and got everything work)
      • 40833
      • 52 Posts
      Quote from: tigrokon at Apr 07, 2013, 08:41 AM
      As it was mentioned above formit also uses phpmailer class (/core/model/modx/mail/phpmailer/class.phpmailer.php)
      The problem was with $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
      (line 482). With $params variable. I just removed it and got everything work)

      This just happened to me yesterday with no visible explanation. As you've seen, most answers have been vague at best, and hackish at worst. However, when I look at this code, it pointed me back to the
      $modx->mail->set(modMail::MAIL_SENDER, $sender);
      in my script, and when I check the value of $sender, sure enough it had a right-single-quote (’) in it. When I removed that, the class instantiated and worked fine.

      So it seems that the problem isn't the $params variable above, the problem is not-so-good error logging in phpMailer (and not being able to accept utf8 characters?).
        • 9995
        • 1,613 Posts
        Had the same issue, the hosting was moved and DNS was copied.
        Had to tell the mailserver the new hosting/website IP.
          Evolution user, I like the back-end speed and simplicity smiley