Mail Template Implementation

I’m writing a custom webshop system. I decided to implement a mail template system to easy my life. The mail template system is’nt depend on the webshop, it’s only my purpose now.

I’d like to discuss the possibilites.

My necessarities:


  • multilangual: (from: messages/{lang_code}/tmplmailer{*}.php
  • skinnable: /views/mail_templates/*.php /body part of the mail, formating the specific purpose/
  • administrator maintenable: store content in database, user can handle every language letters
  • label handling: administrator can use labels to use dinamic fields, default label syntax is: {{label}}
  • dinamic labels: more complex labels is generated from view (/views/controller/part_of_mail.php)


Working process:[/b][/u] (for example: user registration)

[list=1][]user send a valid registration form[]storing data into database[]registration controller proper action load all necessary labels from the registration modul (for example: $this->labels[‘username’])[]the action renders partial the user details with /view/registration/user_data.php view and load it into $this->labels[‘user_data’][]the action config create a MailTemplate model instance.[]setup (if necessary) the skin $mailtmpl->setSkin(‘usermail’); // (/views/mail_templates/user.php)[]load template from the database $mailtmpl->load($id_mail_template, $id_lang);[]change labels into their values[]render mail into a variables (as html and plain content)[]send mail (width phpmailer) and log it into a log_mailer table[/list]

I atached a part of database schema. The field_list field in the mail_template table is a helper to the administratior. It’s purpose to store all the acceptable labesl and it’s description.

I’m waiting for your ideas and thanks to read this “complex” brainstorming …