ebizmarts / magento2-mandrill

Mandrill integration for Magento 2.
https://mandrill.com/
36 stars 36 forks source link

Error thrown in Magento 2.3 when mandrill is not enabled. #100

Closed michaelwylde closed 5 years ago

michaelwylde commented 5 years ago

Describe the bug When the module is installed but not enabled a Fatal error is thrown when trying to send mail.

Fatal error: Uncaught Error: Call to a member function toString() on string in /var/www/magento/vendor/ebizmarts/magento2-mandrill/Model/Message.php:74 

To Reproduce Steps to reproduce the behavior:

  1. Setup vanilla Magento 2.3
  2. Composer in latest Mandrill module
  3. Do not configure Mandrill module - leaving default values.
  4. Attempt to send an email.

Expected behavior Email will fall back to default ZendMessage and be sent successfully.

Additional context This issue can be fixed by changing: (Wrapper should also be applied to setBodyText )

        if ($this->mandrillBodyText) {
            return $this->mandrillBodyText->toString();
        } elseif ($this->mandrillBodyHtml) {
            return $this->mandrillBodyHtml->toString();
        } else {
            return '';
        }

to:

        if ($this->mandrillHelper->isMandrillEnabled()) {
            if ($this->mandrillBodyText) {
                return $this->mandrillBodyText->toString();
            } elseif ($this->mandrillBodyHtml) {
                return $this->mandrillBodyHtml->toString();
            } else {
                return '';
            }
        } else {
            return parent::getRawMessage();
        }

Please let me know if you would like me to raise a PR for this.

goben2489 commented 5 years ago

if ($this->mandrillBodyText) { return $this->convertToString($this->mandrillBodyText); } elseif ($this->mandrillBodyHtml) { return $this->convertToString($this->mandrillBodyHtml); } else { return ''; }

Still dont work when module mandrill is disable and use module magepal/smtp to send test mail and get error:

Screen Shot 2019-04-26 at 3 26 34 PM
Santiagoebizmarts commented 5 years ago

Hello @michaelwylde @goben2489

Thanks for your feedback. We are working on this, stay tuned to find out once the new release compatible with 2.3 gets available.

Kind Regards.

michaelwylde commented 5 years ago

@Santiagoebizmarts Is there any update on when 2.3 update will be available?

gonzaloebiz commented 5 years ago

Hi @michaelwylde

we wrote a new extension for Mandrill for magento >= 2.2.8 Remove this extension (composer remove ebizmarts/magento2-mandrill) and try https://github.com/ebizmarts/magento2-mandrill-smtp

Best

goben2489 commented 5 years ago

Thank you for your response

On Wed, Jun 26, 2019 at 10:57 PM Gonzalo Dominguez notifications@github.com wrote:

Closed #100 https://github.com/ebizmarts/magento2-mandrill/issues/100.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ebizmarts/magento2-mandrill/issues/100?email_source=notifications&email_token=ADSG3DOQJIGBJIHSEQ5TCNDP4OGWPA5CNFSM4G7DT2GKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOSGCNW6Q#event-2441403258, or mute the thread https://github.com/notifications/unsubscribe-auth/ADSG3DJPBGPTOM6BDMX6SCLP4OGWPANCNFSM4G7DT2GA .

--

Lê Thanh Tín Developer TT-Techonogy ĐT : 0948 03 15 15 Email : goben2489@gmail.com