Ive written a script to send html emails and everything works fine. I have an email stored in a separate HTML file, which is then read in a while and fgets () loop. However, I want to be able to pass variables to html. For example, in an html file I might have something like.
<body>
Dear Name <br/>
Thank you for your recent purhcase
</body>
and I read it in a line like this
$file = fopen($filename, "r");
while(!feof($file)) {
$html.= fgets($file, 4096);
}
fclose ($file);
I want to be able to replace the "Name" in the html file with a variable, and I'm not quite sure if this is the best way to do this. I could always make my own tag and then use the regex to replace it with the name as soon as I read the file in a line, but they are wondering if there is a better / easier way to do this.
( , - , file_get_contents fgets, id )