What's the best way to handle transactional emails

Hey guys,

what’s the best way to handle transactional emails (in connection with magento)?

A colleague of mine has already written a message in slack a few days ago:

Konstantin Sölch [17. Juni um 12:48 Uhr]
Hey guys,

we’ve noticed that the registration mails all link to the default magento path. What is the best practice to redirect them to VSF?
4 Antworten

pkarw (Core Team) [vor 16 Tagen]
That’s good idea and we don’t support this feature. I belive the redirect on proxy before magento is one of the solutions probably the easiest one to implement

danielmaier42 [vor 10 Tagen]
@pkarw (Core Team) how do live projects solve this issue? That isn’t anything new… even when adding a proxy, we have to create the corresponding routes in vsf

pkarw (Core Team) [vor 10 Tagen]
Currently most of them leaves it to Magento defaults

Because @pkarw wrote that most people link to magento default, I tested some live implementations (klebefieber.de & majorrum.com) and the password reset link goes back to a magento with the standard luma theme.

Even if it’s not so nice, you can still do it. But after a user has reset his password, he is automatically logged in to the magento and that destroys the whole experience of VS, especially if you leave the theme with the standard magento theme.

For example, we did a lot of editing in the customer account for the user’s orders, if transaction mails are now sent by magento and the user lands in the magento, we would have to edit it there as well.

I am aware that one possibility would be to revise the complete mail logic and possibly even implement an own service for mails via VS API, but that sounds like a lot of work.

I have to admit that we really didn’t consider the mail topic when we’ve deciding for using VS, therefore here this post in the forum, maybe there is someone who has already dealt with it or we could join forces to solve this together.

Thanks for your help,

1 Like

Hi Marvin, thanks for your post.
Good point and definitely something that would need attention on a live build.
I’m not sure if VueStorefront will tackle this particular subject in the near future.

This is something deeply integrated in the e-commerce bankend you might be running (Magento, Shopware, and so on) and would require rewrites in the backend which runs the risk of conflicts.
Personally, I would fix it on the server level (NginX or Apache) or add rewrite rules to Magento in this case.


For almost all transactional emails, it’s just a case of editing the Email Templates in Magento and replacing the Magento coded links with hard-coded links. Look for things like <a href="%account_url">and account_url=$this.getUrl($store,'customer/account/',[_nosid:1]).

Alternatively, you can use a hosted mail service and make new email templates much more easily. We use MailChimp, which is pretty reasonable and works well. There’s a free extension for Magento, to hand over transactional emails. There are other services too, of course.

However, there’s one exception, which you already wrote about - the password reset email.

I spent time trying to resolve this, but couldn’t find any way to modify that email. In the end my solution was to make a really simple Theme for our Magento site, just for hosting the password reset form. After it’s reset, a link to our actual site is displayed and the user instructed to continue to there. Our Magento site is on a different domain, which is not ideal, but it’s much easier to manage. All other urls are caught by Nginx and redirected to a page with a link to our actual website, like a catch-all 404. It’s not a perfect solution but it works.

Feel free to try it out: https://wonect.com

Hey @grimasod,

thanks for your detailed comment. Replacing it with hardcoded links should be doable.

I’ve had something like this in my mind, but i was hoping there might be a better solution. I think we will go with this solution.

Glad to help.

A better solution might be to use another backend instead of Magento :rofl:

Well, at least this solution will do for now. Our VS store has been live for several months and no one has reported any problems with it.

If you come up with anything else, I’d be happy to hear about it

I solved this by creating a plugin for magento and intercepting around Magento\Email\Model\AbstractTemplate::getUrl function. Then decide based on the $route param what to return.

Hello @mileandra
Could you please share the repository with the plugin with our community? It would be so useful.

Thanks in advance!

@Fifciuu I created a gist with the bare basics for this.

That’s wonderful. Thanks a lot @mileandra