Reputation: 1959
I've got an HTML file I use as a template for a PHP email, and I want to just pull the contents of the HTML file and put it in a string, but my PHP content isn't showing.
My current html file can be seen at http://pastebin.com/iNgaHRky
I can get the file to be pulled, but the PHP parts in it aren't running. The email is just coming through as if I was previewing the file itself.
My Code:
ob_start();
include(site_url()."/emails/templates/new_user_admin.html");
$adminMessage = ob_get_clean();
ob_end_clean();
Can anyone let me know if what I'm trying to do is possible, and any way to get this to work?
I've also tried file_get_contents()
Upvotes: 0
Views: 1666
Reputation: 15108
It just interprets the file as a pure string.
I really dont think you should be expecting the php parts to be working. they will just be text now. not php.
You could try using string replace on the string created once you have used file_get_contents() http://php.net/manual/en/function.str-replace.php
So, for example, you would put in the html file {{siteurl}} and use string replace to replace it with something like .site_url()."/emails/images/generic-header.jpg
Upvotes: 1