Hi,
I Try to send email in input process,
i configure gmail in settings.php,
install Swift Mailer php latest (swiftmailer/swiftmailer:^6.0),
Configure path in email.php,
But i got some error in execution time, that is in bellow,
How to resolve this error or configure any other else…
please help to solve this error…
Fatal error: Uncaught Error: Call to undefined method Swift_Message::newInstance() in /home/u885122168/public_html/iot/Lib/email.php:22 Stack trace: #0 /home/u885122168/public_html/iot/Modules/eventp/eventp_processlist.php(83): Email->__construct() #1 /home/u885122168/public_html/iot/Modules/process/process_model.php(62): Eventp_ProcessList->sendEmail(‘At 2018-09-05 0…’, 1536092073, 29, Array, Object(Process)) #2 /home/u885122168/public_html/iot/Modules/process/process_model.php(108): Process->__call(‘sendemail’, Array) #3 /home/u885122168/public_html/iot/Modules/input/input_methods.php(249): Process->input(1536092073, 29, ‘48:30,49:1,47:2…’, Array) #4 /home/u885122168/public_html/iot/Modules/input/input_methods.php(101): InputMethods->process_node(1, 1536092073, ‘2’, Array) #5 /home/u885122168/public_html/iot/Modules/input/input_controller.php(50): InputMethods->post(1) #6 /home/u885122168/public_html/iot/core.php(64): input_controller() #7 /home/u885122168/public_html/iot/index.php(191): controller(‘input’) #8 {main in /home/u885122168/public_html/iot/Lib/email.php on line 22
Please do not double post. I have deleted your other post as it was on the end of a “Solved” thread.
In any case, double posting only creates two possible sets of replies and confuses everyone.
Thank you.
pb66
(Paul)
5 September 2018 09:26
3
This might be because you have installed swiftmailer v6, emoncms usually uses v5.1, possibly because you installed using composer rather than using PECL as indicated in the emoncms install guides.
I have closed your github issue containing a duplicate of the above (for the same reason as Robert gave above) and opened a new issue to discuss the move to v6 (or not) but those changes might not be a swift solution (pun intended ) so switching back to v5.1 might be the answer you need.
opened 09:20AM - 05 Sep 18 UTC
closed 02:40PM - 11 Jul 19 UTC
bug
enhancement
It seems swiftmailer has moved on to v6 which requires PHP v7+ (See [documentati… on](https://swiftmailer.symfony.com/docs/introduction.html#installation)), that in itself is not necessarily a problem as most platforms have moved onto PHP v7+ now. However, it seems v6 no longer uses `newInstance()` (see the [changelog](https://github.com/swiftmailer/swiftmailer/blob/master/CHANGES#L52)) which emoncms does (see [Email.php](https://github.com/emoncms/emoncms/blob/master/Lib/email.php#L22)).
The [PEAR channel](http://pear.swiftmailer.org/) is still available but no longer supported, so if users install using the emoncms install guide, they will still get v5.1.0 and that seems to work as expected with emoncms, even on PHP7.
The latest versions of swiftmailer are available via composer, we have previously discussed moving to using composer rather than PEAR/PECL but since the redis and mosquitto extensions are not serviced on composer it seemed daft making the switch to catch one lesser used module and lose easy access to 2 more essential extensions.
Perhaps we should put a note in the installer guides that emoncms is only compatible with swiftmailer version 5 not 6 as a temporary measure?
Perhaps if we want or need to make the jump to v6 we should look at revising both the code and the install method, (which will possibly mean using both composer and pear.pecl to get all the modules).
Otherwise if sticking with the v5 for the time being, since it isn't going to get any updates, we could include the swiftmailer v5 lib in the emoncms repo to avoid confusion and ensure the right version is available. If users install swiftmailer v6 elsewhere for other applications, emoncms would then still use the included v5 without any issues.
see https://community.openenergymonitor.org/t/input-process-send-email-is-not-working/8454?u=pb66 (and #1013)
Hi pB66,
Thank you for reply.
I downgrade swiftmailer 6.0 to 5.1.0,
Now email is working…
Thanks lot…