Jump to content
thirty bees forum
  • 0

missing swiftmailer causing issues in modules since TB 1.5 update


Question

Posted

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?

3 answers to this question

Recommended Posts

  • 0
Posted

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');

 

  • 0
Posted

Note that this dirty fix is not the best and long term solution. 

Better would be to modify the mail.php file and remove dependency on specific implementation of email transport.

  • 0
Posted
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

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...