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.

    Subscription Widget
    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?

    Thank you!



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



  • @nebulon
    All right! Thank you :D



  • @nebulon
    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?