I am trying to customize extension by adding it to newsletter subscribers, and when I select/check subscribers and send email, I get error as the title suggests.
Error:
1 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): An item needs to be selected. Select and try again.
Exception #0 (Magento\Framework\Exception\LocalizedException): An item needs to be selected. Select and try again.
<pre>#1 MageVision\MassEmailCustomers\Controller\Adminhtml\Email\MassSend->execute() called at [vendor/magento/framework/App/Action/Action.php:108]
I have added necessary classes to the PHP i think, my code is below
https://github.com/nix0x00/newsletter_subscribers/blob/master/massSend.php
I assume its being thrown from line :119 $this->send($item);
.
Can anyone please suggest me whats wrong here?
My XML file is:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="adminhtml.newslettrer.subscriber.grid.massaction">
<arguments>
<argument name="options" xsi:type="array">
<item name="mass_email_customer" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Email to Customers</item>
<item name="url" xsi:type="string">massemailcustomers/email/massSend</item>
<item name="confirm" xsi:type="string" translate="true">Are you sure you want to send an email to the selected subscriber(s)?</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>