PHP File Email Template
From w3cyberlearnings
Contents |
PHP Email Template
This is a simple email template engine, and it uses text file.
File Content(email.txt)
Hi [[:friend]], <br/><br/> How are you [[:friend]]? Today is [[:today]], I will go to shopping mall to buy some clothes.<br/> Do you want to go with me? There are many friend will go with us? Do you know [[:ourfriend]]?<br/> <br/> I am looking forward to hear from you? My number is [[:phonenumber]].<br/> We are going to meet at [[:place]].<br/> <br/> See you, [[:myname]]
Example 1
<?php $file_name = 'email.txt'; $array_email = array('[[:myname]]' => 'John', '[[:friend]]' => 'Cristina', '[[:today]]' => 'Sunday', '[[:ourfriend]]' => 'Janny', '[[:phonenumber]]' => '318-555-333three', '[[:place]]' => 'Dillair Mall'); // open file for reading only $file_content_1 = file_get_contents($file_name); // replace file content $new_file_content = str_replace(array_keys($array_email), array_values($array_email), $file_content_1); echo $new_file_content ; ?>
Output
Hi Cristina, How are you Cristina? Today is Sunday, I will go to shopping mall to buy some clothes. Do you want to go with me? There are many friend will go with us? Do you know Janny? I am looking forward to hear from you? My number is 318-555-333three. We are going to meet at Dillair Mall. See you, John
Related Links
- PHP File Email Template
- PHP File Template with MySQL
- PHP File Access with MySQL