Jump to content
thirty bees forum
  • 0

missing swiftmailer causing issues in modules since TB 1.5 update


smarterweb

Question

In all fairness you have removed swiftmailer to some extent as it's long been depreciated.
we have a coupon module that was relying on it (and maybe other modules as well), which now no longer works since updating to TB 1.5

I am aware that there is still a module for that protocol and of course I have tried using this but the module still throws a 500: 

Class 'Swift_Message' not found
in file modules/awocoupon/helper/mail.php at line 69
Source file: modules/awocoupon/helper/mail.php

I'm not quite sure how to move forward here. Any ideas?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

That's unfortunate. 

This module depends on library that is no longer provided by core.

The dirty fix could probably be to install tbswiftmailer module, and then edit this modules/awocoupon/helper/mail.php file, and include library from tbswiftmailer module. 

require_once(__DIR__ . '/../../tbswiftmailer/vendor/autoload.php');

 

Link to comment
Share on other sites

  • 0
On 10/11/2023 at 7:27 PM, datakick said:

That's unfortunate. 

This module depends on library that is no longer provided by core.

The dirty fix could probably be to install tbswiftmailer module, and then edit this modules/awocoupon/helper/mail.php file, and include library from tbswiftmailer module. 

require_once(__DIR__ . '/../../tbswiftmailer/vendor/autoload.php');

 

The developer of the module has kindly helped me out with a similar fix. He also mentioned that PS 8.x is up to today still including swiftmailer.
If anyone else is using awocoupon and is facing the same issue, here's the solution:

 

From the (old) TB 1.4 zip, copy the folder


   /vendor/swiftmailer/swiftmailer
to
   /modules/awocoupon/asset/swiftmailer

So this file should exists:
   /modules/awocoupon/asset/swiftmailer/lib/swift_required.php


Then in the file
   /modules/awocoupon/helper/mail.php on line 12 is this:

<?php
    public static function sendMail($from, $from_name, $to, $subject, $body, $mode = 0, $bcc = null, $attachments = null, $is_embed = false, $string_attachments = null, $cc = null ) {
?>


Right after that add this:

<?php
        include_once _PS_MODULE_DIR_.'awocoupon/asset/swiftmailer/lib/swift_required.php';

        return self::sendMail3($from, $from_name, $to, $subject, $body, $mode, $bcc, $attachments, $is_embed, $string_attachments);
?>

 

hope others find this useful.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...