Solved How to make Mailtrain widget work?
Hello, I have a question about Mailtrain widget.
Mailtrain widget enables you to embed the newsletter signup form.
On Mailtrain github documentation, they say like this.
The (experimental) Mailtrain Subscription Widget allows you to embed your sign-up forms on your website. To embed a Widget, you need to:
Enable cross-origin resource sharing in your config file and whitelist your site:
[cors] # Allow subscription widgets to be embedded origins=['https://www.example.com']
Embed the widget code on your website:
Does what they say "config file" means production.toml on Cloudron Mailtrain app?
I added the script on .toml file, but it didn’t work on my server. Is there anything I should configure to make it work?
I just gave it a try and yes, you should put the adjusted snippet into /app/data/production.toml inside the mailtrain app and then restart the app (there is a restart button in the terminal view in the Cloudron dashboard for the app)
Thank you for checking and confirmation!
I tried it by myself again. It only showed "Subscribe to our list" link.
I thought I could embed signup forms on my wordpress website.
From what I can tell from the upstream documentation, the widget is mostly an unstyled link for now, pointing to a mailtrain rendered form for subscribing. You would have to style it yourself for now. As it is still marked as experimental, it will probably get enhanced at some point.
All right! Thank you
I tried again, and the widget worked!
I saw only a simple text link because it was wrong. The correct address starts with https://.
(The example code start with http:// but Mailtrain on Cloudron uses https://)
After getting this worked, I'm started to want to customize the widget.
(e.x. I want to use "Thank you for subscribing!" instead of the default message says "It looks like you are already subscribed to this list.")
There's a file called widget-subscribe.hbs where we can customize the appearance of the widget.
However, it is not accessible on Cloudron.
Is(Will be) there any way to customize the widget?
3246 last edited by
Allow subscription widgets to be embedded origins=['https://www.example.com']
Sorry to revive an old topic. Is there a way to combine multiple domains in that statement?
I still get the CORS policy error despite adding the domain to production.toml file regardless.
@3246 I think that syntax should work (well, per the github config syntax).
BTW, mailtrain 1 has not been updated in years since development has stopped. They moved on to mailtrain 2 which is a different code base from mailtrain 1 and not migratable. I would recommend not using mailtrain 1.
3246 last edited by
@girish thanks for the heads-up. I'm using the version packaged with Cloudron. How do I know which one I have?
Does the widget not work with v.2.0?