1

We have to send multiple emails through Magento 2 messaging queue and for emails, we are using SendGrid SMTP, and the module used within Magento to integrate this is of Mageplaza.

When we start the queue, the first few emails send fine without any issue but after a few we receive:

Sendgrid SMTP connection timed out

After this, we start receiving the following error:

Warning: fwrite(): SSL: Broken pipe in vendor/zendframework/zend-mail/src/Protocol/AbstractProtocol.php on line 260

We have found this fix of the above error and override the Mageplaza SMTP module to apply this fix. This does fix the issue but now again after the first few emails, the emails are getting failed and we are getting the following error:

Cannot issue HELO to existing session

The method used to send emails is following:

public function sendEmail($data = null)
{
    try {
        $this->inlineTranslation->suspend();

        $sender = [
            'name' => $this->escaper->escapeHtml($data['sender_name']),
            'email' => $this->escaper->escapeHtml($data['sender_email']),
        ];

        $transport = $this->transportBuilder
            ->setTemplateIdentifier($data['email_template'])
            ->setTemplateOptions(
                [
                    'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
                    'store' => $this->storeManager->getStore()->getId()
                ]
            )
            ->setTemplateVars($data['template_vars'])
            ->setFromByScope($sender)
            ->addTo($data['customer_email'])
            ->getTransport();

        $transport->sendMessage();

        $this->inlineTranslation->resume();

        return true;
    } catch (\Exception $e) {
        $this->logger->critical($e->getMessage());
    }

    return false;
}

We are using Magento enterprise 2.3.3, any help would be appreciated.

1 Answer 1

0

The issue has been reported to the Mageplaza side. You can contact them to ask about the latest version and how to fix this problem

3
  • We did apply the fix as given in the commits of pull request mentioned in the URL you provided but it results in some more issues which are mentioned in the question.
    – Noman
    Commented May 23, 2021 at 18:45
  • 1
    For problems caused by third-party modules, it's best to contact the provider so that the problem can be fixed quickly. They will be the one who understands this module the most and will give you the best possible fix Commented May 25, 2021 at 4:44
  • Thank you for the suggestion. Yes, I did create a ticket, they responded if emails are working fine with cron or basic controller and not working only with the messaging queue so it is most probably not their module issue.
    – Noman
    Commented May 25, 2021 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.