magento-2-smtp
magento-2-smtp copied to clipboard
Store transport per store to prevent possible conflicting SMTP options
Description (*)
This pull requests implements the store specific transports, as related to https://github.com/mageplaza/magento-2-smtp/issues/330
With asynchronous sending
enabled and knowing that in our multi-store installation we have separate SMTP settings for each store, we noticed that the wrong SMTP settings were being used (wrong host, username, password) if in a single batch (the cronjob that is used for asynchronous sending) order confirmation emails existed from more than one store.
This seems to happen because although Mageplaza\Smtp\Mail\Rse::getTransport
receives the storeId
, it only creates a new Transport
instance (with the correct SMTP options of the first shop) the first time it is called, instead of the first time per store.
This PR simply adds similar behaviour for the transport instances, as already exists for other variables in this class. With this change, we could verify that each confirmation email used the correct SMTP settings, even if we had multiple stores in a single run.
Fixed Issues (if relevant)
- Fixes mageplaza/magento-2-smtp#330
Manual testing scenarios (*)
- Setup multiple stores, each with different SMTP options (for example, distinct usernames)
- Force multiple order confirmation within one minute, where the order come from different stores.
- Verify that each order is actually send out with the correct SMTP options
Questions or comments
This change solved the incorrect behaviour in our installation. We are not aware of any side effects, especially since in most times, only a single store will be present in a batch.
Thanks for your pull request. We'll check this out and let you know when the testing is over.