Jump to content
mdekker

[Free Module] SwiftMailer upgrader - version 5.4.1

Recommended Posts

Easily upgrade PrestaShop's SwiftMailer to version 5.4.1 with this module and enable support for STARTTLS (e.g. Gmail, Outlook, etc.)

 

Installation

  • Upload the module through FTP or your Back Office
  • Install the module
  • Check if there are any errors and correct them if necessary
  • Profit!

Compatibility

This module is compatible with versions:

  • 1.6.0.0 - 1.6.1.4
  • 1.5.0.0 - 1.5.6.3

Do not use this module with PrestaShop 1.6.1.5 or higher

 

Requirements

  • PHP >= 5.4

Lower versions could also work, but is not guaranteed.

 

License

Academic Free License 3.0

 

Repository

https://github.com/firstred/swiftupgrader

 

Download

https://github.com/firstred/swiftupgrader/releases/download/1.0.2/v1.0.2-swiftupgrader.zip

Share this post


Link to post
Share on other sites

Thanks. But i'm still getting an error referring to swift mailer version. 

 

The current version is @version 3.3.2

 

How do I update this? 

Share this post


Link to post
Share on other sites

You shouldn't update!

 

You should see where the error comes from and try to address is.

The SwiftMailer included with PrestaShop is what should work by default.

 

Do you use some conflicting module, such as a newsletter module? I know that some of them include SwiftMailer and that might break things.

Share this post


Link to post
Share on other sites

These are the errors:

 

Fatal error: Cannot redeclare class Swift in /home2/dstore/public_html/tools/swift/Swift.php on line 32
 
Fatal error: Call to undefined method Swift_Message::newInstance() in /home2/dstore/public_html/classes/Mail.php on line 179
 
It's affecting orders, accounts can't be created, password recovery is also affected.
 
Please help. Thank you.

Share this post


Link to post
Share on other sites

I'm newbie, my prestashop version is 1.6.1.4.

May I ask how to upgrade or install this SwiftMailer?

Can advice some step detail?

Hi @UltraCom,

 

You can just install the module in the usual way, by uploading it through the back office of your store:  http://doc.prestashop.com/display/PS16/Modules+and+Themes+Catalog

Share this post


Link to post
Share on other sites

hi @mdekker i tried this on my local site and it seems on the contact form it causes an error 500

[Mon May 16 09:54:44.577963 2016] [:error] [pid 21049] [client 10.1.10.202:43951] PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, class 'Swift_Mime_EmbeddedFile' not found in /var/www/html/1.6.1.4/modules/swiftupgrader/lib/swiftlatest/classes/Swift/EmbeddedFile.php on line 33, referer: http://10.1.10.202/1.6.1.4/index.php?controller=contact&live_configurator_token=7401c08cc537ac39f9841b541b359d38&id_shop=1&id_employee=1&theme=&theme_font=
 
[Mon May 16 09:54:44.577995 2016] [:error] [pid 21049] [client 10.1.10.202:43951] PHP Fatal error:  Call to a member function has() on a non-object in /var/www/html/1.6.1.4/modules/swiftupgrader/lib/swiftlatest/classes/Swift/Mime/SimpleMimeEntity.php on line 615, referer: http://10.1.10.202/1.6.1.4/index.php?controller=contact&live_configurator_token=7401c08cc537ac39f9841b541b359d38&id_shop=1&id_employee=1&theme=&theme_font=
 
You may want to take a look at that... (got that from tailing my logfile)

Share this post


Link to post
Share on other sites

If you can you should update the download link on the original post to be for version 1.0.2. I downloaded and installed the 1.0.1 without seeing the download for 1.0.2. After installing the 1.0.1 upgrade module my store stopped receiving the return statuses from PayPal. I have Prestashop 1.6.4 and use the built-in PayPal USA module to handle PayPal Express payments and also use the PayPal Pro paid module to handle direct credit card entry. After installing the upgrade module orders that came in had no status and Prestashop showed no payment though I was able to confirm payment through PayPal. After uninstalling the upgrade module orders started working correctly again. The only errors I could find were the same as what David Eschmeyer had reported. I don't know if I still would have issues if I had download 1.0.2 or if it was because of the issue in 1.0.1. I just thought I would report this in case anyone else experiences it. I'm not going to try installing 1.0.2 of the upgrade module, I'll just wait until Prestashop release 1.7 or at least a more worthwhile upgrade before updating.

Thank you.

Share this post


Link to post
Share on other sites

Thanks for the warning. I thought that I had updated it to 1.0.2, but apparently only the link text has changed, not the actual link itself. Should be fine now.

Share this post


Link to post
Share on other sites

It works fine now. I disabled the mailjet newsletter module.

 

And everything is back to normal. Thank you.

Hello,

 

We have released a new version of our module that is compatible with PrestaShop 1.6.1.5 (with the new paths for SWIFT), you could download it from here:

 

https://github.com/mailjet/prestashop-mailjet-plugin-apiv3

 

Regards,

 

Mailjet team 

 

Share this post


Link to post
Share on other sites

I've a problem:

 

if I use the suggested mail() PHP function I can send mail to everyone excluded my scardovi.com domain (google apps mail server).

 

il I use the SMTP with google settings I receive "Failed to authenticate on SMTP server with username "username@scardovi.com" using 2 possible authenticators" error and so I can't send mail to anyone.

 

What can I do?

Share this post


Link to post
Share on other sites

I've a problem:

 

if I use the suggested mail() PHP function I can send mail to everyone excluded my scardovi.com domain (google apps mail server).

 

il I use the SMTP with google settings I receive "Failed to authenticate on SMTP server with username "username@scardovi.com" using 2 possible authenticators" error and so I can't send mail to anyone.

 

What can I do?

 

do you have 2 step authentication enabled?  

 

You may want to look at https://support.google.com/accounts/answer/6010255?hl=en

https://www.google.com/settings/security/lesssecureapps

Share this post


Link to post
Share on other sites

Hi

 

I have installed this swiftmailer upgrade module on my prestashop 1.6.1.4 and everything is working fine except a modification, to send a email copy to an extra email adress when a order is shipped, that i made to my classes/mail.php from this thread https://www.prestashop.com/forums/topic/376904-how-to-email-copy-of-terms-and-conditions-for-each-shipped-order/

 

I have checked the classes/mail.php file and nothing has changed in this file.

 

Anyone who know why the modification has stops working and how i can send the extra email again ?

 

Best regards John

 

 

Share this post


Link to post
Share on other sites

You'll have to modify the override at /override/classes/Mail.php. Never edit Core files directly! You will no longer be able to update PrestaShop. 

Share this post


Link to post
Share on other sites

Hi mdekker, thanks for the free swiftmailer upgrade module. I managed to setup the module and sent a message from the BO. But when I try to use my contact form to send a message, it leads to a non-existent page. Would you be able to pinpoint the error for me? Thanks in advance for your help.

Share this post


Link to post
Share on other sites

You'll have to modify the override at /override/classes/Mail.php. Never edit Core files directly! You will no longer be able to update PrestaShop. 

 

well, you will be able to update, but the core modifications will have to be repeated after the upgrade since on upgrade all the files are replaced.  The module solution is safe, but once you get to prestashop 1.6.1.5 you have to uninstall it because swift has been upgraded in that version.

Share this post


Link to post
Share on other sites

You'll have to modify the override at /override/classes/Mail.php. Never edit Core files directly! You will no longer be able to update PrestaShop. 

Thank you for the answer. I have tried to put the same code in the same place in the /override/classes/Mail.php

            $to_list->addTo($to, $to_name);

        }

if($template == 'shipped')

{$to_list->addBcc('xxxxxxx@xxxxxx.com', 'admin');}

        if (isset($bcc)) {

            $to_list->addBcc($bcc);

 

But when i set an order as shipped i get a blank page in the admin and no mails er sent.

The same code works fine in the original mail.php file

Share this post


Link to post
Share on other sites

Hi everyone.

 

I had a lot of Swift error since I updated prestashop from v1.5.2 to 1.6.1.6, so I installed this module.

It works great, I have no longer the itnernal server error 500 when updating an order status.

 

But when I place an order as a customer, after confirmation, i get this :


Fatal error: Uncaught TypeError: Argument 1 passed to SwiftUpgrade_Mime_SimpleMessage::__construct() must be an instance of SwiftUpgrade_Mime_HeaderSet, none given, called in /home/site3776/web/www/modules/swiftupgrader/lib/swiftlatest/classes/Swift/Message.php on line 48 and defined in /home/site3776/web/www/modules/swiftupgrader/lib/swiftlatest/classes/Swift/Mime/SimpleMessage.php:27 Stack trace: #0 /home/site3776/web/www/modules/swiftupgrader/lib/swiftlatest/classes/Swift/Message.php(48): SwiftUpgrade_Mime_SimpleMessage->__construct() #1 /home/site3776/web/www/modules/swiftupgrader/lib/swiftlatest/classes/Swift/Message.php(75): SwiftUpgrade_Message->__construct(NULL, NULL, NULL, NULL) #2 /home/site3776/web/www/override/classes/Mail.php(80): SwiftUpgrade_Message::newInstance() #3 /home/site3776/web/www/classes/order/OrderHistory.php(469): Mail::Send(5, 'cheque', 'En attente du p...', Array, 'stabbquadd@gmai...', 'Sylvain Lano', 'sylvain.lano@fe...', 'f\xC3\xA9eduth\xC3\xA9.com', NULL, NULL, '/home/site3776/...', false, in /home/site3776/web/www/modules/swiftupgrader/lib/swiftlatest/classes/Swift/Mime/SimpleMessage.php on line 27

Any idea what I should do ?

 

Regards.

Share this post


Link to post
Share on other sites

Thank you for the answer. I have tried to put the same code in the same place in the /override/classes/Mail.php

            $to_list->addTo($to, $to_name);

        }

if($template == 'shipped')

{$to_list->addBcc('xxxxxxx@xxxxxx.com', 'admin');}

        if (isset($bcc)) {

            $to_list->addBcc($bcc);

 

But when i set an order as shipped i get a blank page in the admin and no mails er sent.

The same code works fine in the original mail.php file

I get this error in my log file PHP Fatal error: Call to a member function addBcc() on null in /home/e/_/xxxx/override/classes/Mail.php on line 102

 

Do you know how i can fix this ?

 

Best regards John

Edited by Bonjovi67

Share this post


Link to post
Share on other sites

Hi everyone.

 

I had a lot of Swift error since I updated prestashop from v1.5.2 to 1.6.1.6, so I installed this module.

It works great, I have no longer the itnernal server error 500 when updating an order status.

 

But when I place an order as a customer, after confirmation, i get this :


Fatal error: Uncaught TypeError: Argument 1 passed to SwiftUpgrade_Mime_SimpleMessage::__construct() must be an instance of SwiftUpgrade_Mime_HeaderSet, none given, called in /home/site3776/web/www/modules/swiftupgrader/lib/swiftlatest/classes/Swift/Message.php on line 48 and defined in /home/site3776/web/www/modules/swiftupgrader/lib/swiftlatest/classes/Swift/Mime/SimpleMessage.php:27 Stack trace: #0 /home/site3776/web/www/modules/swiftupgrader/lib/swiftlatest/classes/Swift/Message.php(48): SwiftUpgrade_Mime_SimpleMessage->__construct() #1 /home/site3776/web/www/modules/swiftupgrader/lib/swiftlatest/classes/Swift/Message.php(75): SwiftUpgrade_Message->__construct(NULL, NULL, NULL, NULL) #2 /home/site3776/web/www/override/classes/Mail.php(80): SwiftUpgrade_Message::newInstance() #3 /home/site3776/web/www/classes/order/OrderHistory.php(469): Mail::Send(5, 'cheque', 'En attente du p...', Array, 'stabbquadd@gmai...', 'Sylvain Lano', 'sylvain.lano@fe...', 'f\xC3\xA9eduth\xC3\xA9.com', NULL, NULL, '/home/site3776/...', false, in /home/site3776/web/www/modules/swiftupgrader/lib/swiftlatest/classes/Swift/Mime/SimpleMessage.php on line 27

Any idea what I should do ?

 

Regards.

Hello,

 

Same problem, did you find any solutions ? Or someone else ? 

 

Thanks !

Edited by Korhan

Share this post


Link to post
Share on other sites

Hi there,

 

You got this problem because the mail can't be sent. I had just the same.

To be honest, after solving a few problems, SwiftMailer Upgrader created new ones, so I deleted it, and then everything went alright.

 

You should also check your defines.inc.php in the folder config/, and set the _PS_MODE_DEV_ to false.
This way, even if the mail is not send, there won't be a bad error displaying for your customers to see.

define('_PS_MODE_DEV_', false);

Share this post


Link to post
Share on other sites

 

Hi there,

 

You got this problem because the mail can't be sent. I had just the same.

To be honest, after solving a few problems, SwiftMailer Upgrader created new ones, so I deleted it, and then everything went alright.

 

You should also check your defines.inc.php in the folder config/, and set the _PS_MODE_DEV_ to false.

This way, even if the mail is not send, there won't be a bad error displaying for your customers to see.

define('_PS_MODE_DEV_', false);

Actually my problem is that prestashop send the mails but I'm not receiving every mail because they are being refused by gmail. However, when I'm using the php mail() function or an upgraded version of swiftmailer I receive every mail . I guess it's a problem with the support of TLS and I have to upgrade swiftmailer 

Edited by Korhan

Share this post


Link to post
Share on other sites

Thank you for the answer. I have tried to put the same code in the same place in the /override/classes/Mail.php

            $to_list->addTo($to, $to_name);

        }

if($template == 'shipped')

{$to_list->addBcc('xxxxxxx@xxxxxx.com', 'admin');}

        if (isset($bcc)) {

            $to_list->addBcc($bcc);

 

But when i set an order as shipped i get a blank page in the admin and no mails er sent.

The same code works fine in the original mail.php file

I finally got my problem solved, if anyone should have the same issue. For some reason the to_list variable has been changed to message in the override file, so when i changed that in the inserted (red) code everything worked fine again.

 

Thank you mdekker for your effort to make a great free module that is working perfect and solves the TLS problem for those who dont want to upgrade prestashop right now.

Edited by Bonjovi67

Share this post


Link to post
Share on other sites

SwiftMailer is software that Prestashop uses to deliver emails.  However the version of SwiftMailer that Prestashop used, is very old, and does not support modern encryption that some SMTP providers require.

 

This module upgrades the version to a more recent version of SwiftMailer to remedy that issue.

 

However if you are using PS v1.6.1.5 or higher, then this module is not likely required, since Prestashop finally got their act together and upgraded SwiftMailer.

Share this post


Link to post
Share on other sites

Hi everyone,

 

I have Prestashop 1.6.1.4. I'm trying to setup the system to use my own SMTP server, but I'm getting this error:

Failed to authenticate on SMTP server with username "xxx@abc.com" using 2 possible authenticators

Ultimately, I need this to work for an office365 account, but I also tried my own and I get the same message. 

 

I put in port 465 for SSL and the correct login info, but when I test the mail, that's the message I get. 

 

Any ideas??

 

Thanks!

Edited by roroPrestashop

Share this post


Link to post
Share on other sites

Thanks for your help, but could you please explain what you mean bellini13? I'm putting in the correct username and password, so that should be ok, but what do you mean by "trying to send FROM an authorized user"? 

Maybe this would help:

The shops main address is shop@ and this is the address that I'm using for the SMTP settings as well. Could this be a problem? Also, I have the MX records set to connect the Office account as well.

 

David - I don't have 2FA enabled to the best of my knowledge. What is an application specific password?

Share this post


Link to post
Share on other sites
Failed to authenticate on SMTP server with username "xxx@abc.com" using 2 possible authenticators

 

 

Yeah, I've seen this message, too, and I thought that it was related to 2FA, but in the end it turned out that the settings in Google Admin were just plain wrong. The email address and IP were not permitted to send mails.

Share this post


Link to post
Share on other sites

Yeah, I've seen this message, too, and I thought that it was related to 2FA, but in the end it turned out that the settings in Google Admin were just plain wrong. The email address and IP were not permitted to send mails.

What do you mean they weren't permitted to send mails? Where do I give them the permission? :)

Share this post


Link to post
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

×