Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to insert your own HTML #1686

Closed
Satishglk opened this issue Jan 22, 2024 · 5 comments
Closed

How to insert your own HTML #1686

Satishglk opened this issue Jan 22, 2024 · 5 comments
Labels
question Further information is requested

Comments

@Satishglk
Copy link

This is a question and not an issue/

'Thank you all again for the great product. It is a life saver for me. I am looking for some information regarding templates. I went through the listmonk template section and documents.

Is there anyway i can inject HTML coming from another source into the emails. I tried (with limited knowledge i have with HTML and templates) tweaking the templates , using Safe, etc but no luck. My requirement is that i am getting a portion of HTML from another system that i am trying to see if i can incorporate it into the larger email.

for example something like this ,

.... .. ... .....

Appreciate all your help!

@Satishglk Satishglk added the question Further information is requested label Jan 22, 2024
@knadh
Copy link
Owner

knadh commented Jan 24, 2024

{{ "<b>x</b>" | Safe }} is the way to go. Please share a snippet of what you've tried.

@waza-ari
Copy link

waza-ari commented Jan 25, 2024

Hi, I was having a similar issue, but when converting this:

{{ .Tx.Data.headline }}

into this

{{ .Tx.Data.headline | Safe }}

I'm getting an error when trying to preview or when sending the transactional message (actually need to correct myself, sending the mail works, just preview is broken). Going to open a separate bug report for that.

{"message":"globals.messages.errorFetching: Invalid arguments"}

Logs don't show anything unfortunately. Do you have any idea where to look at?

@knadh
Copy link
Owner

knadh commented Jan 28, 2024

Hi @Satishglk. In preview, .Tx.Data.headline is nil, hence the error. Ideally, the preview should be able to take a dummy JSON{} structure that can be filled to get a true preview. Will consider that for some future version.

@Satishglk
Copy link
Author

{{ "<b>x</b>" | Safe }} is the way to go. Please share a snippet of what you've tried.

This is what i tried and didn't work.

{{.Subscriber.Attribs.myattribute1 | Safe }}

@Satishglk
Copy link
Author

Satishglk commented Jan 29, 2024

<p> {{.Subscriber.Attribs.myattribute2 | Safe }}</p>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants