6

I have a Magento ver. 2.1.3 setup that is not sending any emails.

I'm trying to fix this, but nothing I do seems to work.

My server has protections against spam which forces scripts to use SMTP.

I've read that I would need an extension for that, so I've tried MagePal_GmailSmtpApp and Mageplaza_Smtp, none of them worked.

I've followed their instructions correctly and they were installed correctly, I could setup their config in the dashboard, both of them offered a "test" email and they both worked, it's just the regular Magento emails that were not working.

The gmailsmtpapp extension at least gave an error:

Fatal error: Uncaught Error: Call to undefined method Smartwave\Porto\Model\Transport\Interceptor::getMessage() in /home/user/public_html/vendor/magepal/magento2-gmailsmtpapp/Plugin/Mail/TransportPlugin.php:29 

Stack trace:
#0 /home/user/public_html/vendor/magento/framework/Interception/Interceptor.php(142): MagePal\GmailSmtpApp\Plugin\Mail\TransportPlugin->aroundSendMessage(Object(Smartwave\Porto\Model\Transport\Interceptor), Object(Closure))
#1 /home/user/public_html/var/generation/Smartwave/Porto/Model/Transport/Interceptor.php(26): Smartwave\Porto\Model\Transport\Interceptor->___callPlugins('sendMessage', Array, Array)
#2 /home/user/public_html/vendor/magento/module-customer/Model/EmailNotification.php(239): Smartwave\Porto\Model\Transport\Interceptor->sendMessage()
#3 /home/user/public_html/vendor/magento/module-customer/Model/EmailNotification.php(297): Magento\Customer\Model\EmailNotification->sendEmailTemplate(Object(Magento\Customer\Model\Data\Customer), 'customer/passw in /home/user/public_html/vendor/magepal/magento2-gmailsmtpapp/Plugin/Mail/TransportPlugin.php on line 29

I've tracked down the Interceptor class to a file in /var/generation/Smartwave/Porto/Model/Transport

It looks like this:

<?php
namespace Smartwave\Porto\Model\Transport;

/**
 * Interceptor class for @see \Smartwave\Porto\Model\Transport
 */
class Interceptor extends \Smartwave\Porto\Model\Transport implements \Magento\Framework\Interception\InterceptorInterface
{
    use \Magento\Framework\Interception\Interceptor;

    public function __construct(\Magento\Framework\Mail\MessageInterface $message)
    {
        $this->___init();
        parent::__construct($message);
    }

    /**
     * {@inheritdoc}
     */
    public function sendMessage()
    {
        $pluginInfo = $this->pluginList->getNext($this->subjectType, 'sendMessage');
        if (!$pluginInfo) {
            return parent::sendMessage();
        } else {
            return $this->___callPlugins('sendMessage', func_get_args(), $pluginInfo);
        }
    }
}

Now I'm trying to go more in depth to debug this, but I can't find any useful information or documentation that is for programmers.

On some answers here I've read that Magento is queuing emails and a cron-job is sending them, where is it queuing them? Could I just make a script that reads this queue and process the emails myself?

Anyone knows where I could find more information on how the email system works in Magento 2.1?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.