Can't get the Cognetif ApiMail app to fully work

  • Hello,


    I am trying to use the Cognetif ApiMail app with SendGrid.


    • I created an account at SendGrid and have an API-key;
    • I installed the app via the zip-upload to the server;
    • Then I used composer inside /perch/addons/apps/cognetif_apimail to install sendgrid etc;
    • I added cognetif_apimail to my apps.php;
    • In my config.php I added the following:


    Code
    1. define('PERCH_EMAIL_FROM', 'my_email');
    2. define('PERCH_EMAIL_FROM_NAME', 'Mike');
    3. define('PERCH_EMAIL_USERNAME', 'my_email');
    4.     define('PERCH_EMAIL_METHOD', 'api');
    5. define('COGNETIF_APIMAIL_CONNECTOR', '\Cognetif\ApiMail\Connections\SendGridApi');
    6. define('COGNETIF_APIMAIL_SENDGRID_KEY', 'MY_SENDGRID_API_KEY');
    • I created a perch form template;
    • I filled the form options in Perch to send a response and autoresponse;
    • When submitting the form on my website I get the following PHP error(s):
    Code
    1. [Sun Jan 12 14:14:08.525337 2020] [fcgid:warn] [pid 25969:tid 140225908926208] [client 163.158.104.251:49850] mod_fcgid: stderr: PHP Fatal error: Uncaught TypeError: Return value of Cognetif\\ApiMail\\Manager::email_send() must be an instance of Cognetif\\ApiMail\\void, none returned in [MY_PATH]/perch/addons/apps/cognetif_apimail/lib/Cognetif/ApiMail/Manager.php:49, referer: http://[MY_DOMAIN]/contact
    2. [Sun Jan 12 14:14:08.525505 2020] [fcgid:warn] [pid 25969:tid 140225908926208] [client 163.158.104.251:49850] mod_fcgid: stderr: Stack trace:, referer: http://[MY_DOMAIN]/contact
    3. [Sun Jan 12 14:14:08.525511 2020] [fcgid:warn] [pid 25969:tid 140225908926208] [client 163.158.104.251:49850] mod_fcgid: stderr: #0 [MY_PATH]/perch/core/lib/Perch.class.php(232): Cognetif\\ApiMail\\Manager::email_send(Object(PerchSystemEvent)), referer: http://[MY_DOMAIN]/contact
    4. [Sun Jan 12 14:14:08.525516 2020] [fcgid:warn] [pid 25969:tid 140225908926208] [client 163.158.104.251:49850] mod_fcgid: stderr: #1 [MY_PATH]/perch/core/lib/PerchEmail.class.php(337): Perch->event('email.send', Object(PerchSystemEventSubject)), referer: http://[MY_DOMAIN]/contact
    5. [Sun Jan 12 14:14:08.525521 2020] [fcgid:warn] [pid 25969:tid 140225908926208] [client 163.158.104.251:49850] mod_fcgid: stderr: #2 [MY_PATH]/perch/addons/apps/perch_forms/PerchForms_Form.class.php(304): PerchEmail->send(), referer: http://[MY_DOMAIN]/contact
    6. [Sun Jan 12 14:14:08.525525 2020] [fcgid:warn] [pid 25969:tid 140225908926208] [client 163.158.104.251:49850] mod_fcgid: stderr: #3 [MY_PATH]/perch/addons/apps/perch_forms/PerchForms_Form.class.php(142): PerchForms_Form->_send_email(Object(stdClass), Array), referer: http://[MY_DOMAIN]/contact
    7. [Sun Jan 12 14:14:08.525529 2020] [fcgid:warn] [pid 25969:tid 140225908926208] [client 163.158.104.251:49850] mod_fcgid: stderr: #4 /home/kndrxwbst/domains/kend in [MY_PATH]/perch/addons/apps/cognetif_apimail/lib/Cognetif/ApiMail/Manager.php on line 49, referer: http://[MY_DOMAIN]/contact
  • Hey. Thanks for catching this. Its a bug with the app on php 7.0. Which had a return type of void specified and this wasn't introduced until 7.1.


    I guess i hadden't actually tested on 7.0 specifically.


    I've fixed the issues and pushed the code to GitHub. You can download v0.1.1 to get the version with the fix.

  • Thank you, I will try it out this evening!


    Next time I will create the issue on Github. My line of thought was that you often hang around here and maybe it could be an issue related to my Perch config's or something in that direction.


    I will let you know here if it worked for me.


    Mike