Email Template Engine


I want to send mail with Email Template Engine feature , How can I do this easily ?

I want to save templates in database and replace some fields and send mail , my question is about how to replace fields? Here is my email template that contains all my needs

Dear {fullname}

Here is new products list

{foreach products as product}

    ID :{}

    name :{}


I just need a simple template engine class that apply to my template string( not template file)


any idea?

:( Still Waiting for reply !

You can use php platform function strtr.

Find more here:

With this function I can just replace variable , How can I have loop?