I’m trying to send HTML emails.
It worked perfectly until I switched for a secured https://. Now my file_get_contents returns an Unknow protocol error I can’t manage to overcome.
My question is : is there a file_get_contents equivalent in Kirby that could make it easier for me to fetch content ?
Or would it be no help at all anyway ?
Oh nice, I didn’t think of a snippet. Thanks for your answer !
Turns out my https problem is an issue that OVH is aware of and they will deploy a fix soon.
I got it to work with an ugly str_replace("https://mydomain", "http://mydomain:443", $url); for now, but I’d rather manage it differently.
It seems way more convenient but I wonder, how would you keep a log of the unsent mails ?
This way (creating pages) I create the page -> send the mail -> if successfully sent I delete the page, if not I don’t, and keep it at hand in an ‘unsent mails’ list so that I can reschedule it, for example, or just be informed of the error after the harm is done.
You could still create the page and then get the data for the snippet from the page instead of directly from the form, that was just an example. As an alternative, you can keep a log file.
Emails are sent, snippets are called, pages are created, deleted, it works fine.
But my problem is, I have a multi-lang setup, and calling the snippet without any language context, all the l::get of my snippet return an empty string. I’ve made some attempts but nothing succeeded, how could I activate a language (from its code as an argument, or another way) once I’m on the snippet without prior context ?
I didn’t have access to the whole language data since I previously only needed to create a page url with the appropriate code.
Now what I’m doing is I’m getting the html tag’s lang attribute from the front, include it in the data I send in my Ajax request, then require the appropriate language file when I trigger the function :