Is there like a way to make it so a webhook is detected when a post is published AND get like the “email HTML” from it(since it has to pass it somewhere when it uses the Mailgun API) and then be able to do things like send it via Emailit or another respective provider?
Emailit does support bulk sending over SMTP and I use it for all sorts of other things. How can we, at minimum, get that “HTML” content that shows in the email preview pane when you send a newsletter. See below:
I want to be able to grab this HTML ^ above and then be able to use it how I please(aka another email provider).
Best advice: open your browser’s network tab and watch the network calls that are made when you preview email. I don’t know whether that endpoint takes an api key or only a cookie, but if there’s an endpoint, you’re likely to identify it that way.
(I’m also not 100% sure that endpoint actually returns the table based html needed for email, but again, short of hacking the core, that’s the place to look.)
Short answer: No.
Long answer: Yes. Here is how:
I would do it by running up a fake Mailgun API server, change Mailgun URL of Ghost to my server and inside the server, when you get send mail requests (a POST
request to the /v3/{domain}/messages
path), you can do whatever you want with that, including calling Emailit SMTP (I would recommend to use their API though, not SMTP), and return a successful response in the style of Mailgun API.
But, this will break some newsletter insights of Ghost Admin. Because Ghost is not using Mailgun only for sending mails but also getting deliverability insights from it. In theory, you can interfere those requests as well, but I don’t know if you can provide these information with Emailit.
And after you are successful about this, you will always need to observe Ghost updates if it breaks your implementation because of a change how Ghost uses Mailgun API.
So, you would really consider carefully if you really really need that.
Best way of handling this is proposing an E-mail service adapter solution to Ghost with a PR on GitHub. After having a proper adapter API, it will be theoritcally possible to send emails from anywhere.
1 Like