Could not instantiate mail function after update

TGoodrich

New Member
Hi,

I just updated to Joomla v3.6 and also updated Fabrik to v3.5.

I have Fabrik set up to send an email when records are added or updated. Since updating Joomla and Fabrik I get a notice saying "Could not instantiate mail function." after updating or adding records.

Any idea what could be causing this? Is a bug introduced during the update?

Thanks,
Tracey
 
If it helps I just found the following in my error logs,
[27-Jul-2016 17:56:54 CST6CDT] PHP Notice: Undefined property: stdClass::$o2yis_fab_agendas_minutes___id_raw in /home/townofsa/public_html/plugins/fabrik_element/fileupload/fileupload.php on line 1614
[27-Jul-2016 17:56:54 CST6CDT] PHP Notice: Undefined variable: result in /home/townofsa/public_html/libraries/joomla/mail/mail.php on line 479
[27-Jul-2016 18:28:30 CST6CDT] PHP Notice: Undefined variable: result in /home/townofsa/public_html/libraries/joomla/mail/mail.php on line 479
 
Also if it helps, my Joomla install and other components can send email, it seems Fabrik is the only one that can not send emails anymore. Something changed in the last Fabrik update that is causing this and I am beating my head against the wall trying to figure out what is going wrong here.

I see the 3.5 change log says improvements were made to the email plugin. Could you tell me what was changed?

Thanks
 
Hi Hugh,

No not attaching files. I am using a custom php template for the emails. The templates is using Fabrik table placeholders for data related to the form.

I couldn't figure this out so I tried switching from Joomla's PHP Mailer to SMTP and now Fabrik emails are sending.

Not sure why it stopped working using PHP Mailer. It had been working great for several months until the update.
 
I'm not sure either, but I never use the PHP Mailer and strongly recommend that nobody ever does, as it is so dreadfully unreliable, and should only be used as a last resort if you can't use the SMTP method.

I'll try switching to it, see if I can see what's going on.

-- hugh
 
I still can't replicate this with the PHP Mailer.

One of the reasons we re-wrote our mails ending code was to work round a bug introduced into J! in 3.5, whereby it would throw that "cannot instantiate" error if it couldn't find an attached file, instead of just ignoring it like it used to.

Do you have a file upload element on that form, and if so do you have "Email files" enabled in the main options?

Do you have "Attach PDF view" set in the email plugin settings?

-- hugh
 
Hi Hugh,

I do have 3 file upload elements for my form. I just checked my settings and I found that I did indeed have "Email Files" set to enabled for one element.

I'm not sure why it was enabled so I'm guessing it was an oversight on my part. Could that have caused the issue since my php email template doesn't call for a file?

As far as "Attach PDF view" in email plugin settings, I have this disabled.

Either way I will take your recommendation and stick with SMTP especially since it seems to be working ok.

Thanks
 
I'm really just fishing for possible clues, as the code in the J! PHP Mailer which is blowing up deals with adding attachments to the form. But looking at the error it is throwing ("undefined variable result"), and at the code, I really don't see how our code could be tickling that.

-- hugh
 
I'm having the same trouble. Just updated from the Github.

I was able to solve the problem by reverting part of the code in /plugins/fabrik_form/email/email.php to the previous version.

I changed the mailer back from FabrikWorker mailer to the Joomla mailer.

I changed the following lines:
Code:
$res = FabrikWorker::sendMail(
           $emailFrom,
           $emailFromName,
           $email,
           $thisSubject,
           $thisMessage,
           $htmlEmail,
           $cc,
           $bcc,
           $thisAttachments,
           $returnPath,
           $returnPathName,
           $customHeaders
         );
to
Code:
$mail = JFactory::getMailer();
$res = $mail->sendMail( $emailFrom, $emailFromName, $email, $thisSubject, $thisMessage, $htmlEmail, $cc, $bcc, $thisAttachments, $returnPath, $returnPathName);
 
What method are you using? PHP or SMTP?

I'd like to take a look at your site, and insert some debug code, to see what the issue is. The problem being, I've never been able to duplicate these issues locally, so it's impossible to debug them. I need to get my hands on a system which is "reliably failing", so I can figure it out.

The FabrikWorker::sendMail() basically does exactly the same as the J! helper, but adds a couple of extra sanity checks, and does a couple of things to improve spam scores. But nothing that should affect the actual delivery of mail.

-- hugh
 
I haven't tried it with SMTP, but both other PHP options.

This is a fairly simple website with very little Fabrik on it. I'd be glad to give you access to the site or you can give me some code to insert.

Dave
 
Awesome.

Could you fill out http://fabrikar.com/you/my-sites

I'll need the backend login, and either ftp details, or you could install exTplorer, so I can edit the code. The later is easier for me, so I don't have to add Yet Another Site to my FileZilla config.

And if you can set it up such that there is a simple form I can test with, where I can just enter my email in a field.

-- hugh
 
OK, fixed.

Turns out it's because you are using sendmail, and (after much digging) it seems that sendmail doesn't like To address in the long form ...

To: "Hugh Foo" <hugh.foo@foo.com>

... it only likes 'em in the short form ...

To: hugh.foo@foo.com

We tweaked our sendMail helper to use the long form, to help with spam scoring (some of the major spam filters ding you if you don't have the <> format of address).

Really, deep down, it's a bug in either J!'s mailer, or the PHPMailer class, which shouldn't bother creating the long form if using sendmail, as we use the $mailer->addRecipient($address, $name) method, which is supposed to grok what format the target mail client expects.

-- hugh
 
Thank you...I should have just set up SMTP. Nice to know about the spam dinging. I'm been trying to figure out where else I'm using that plugin.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top