Email templates customization

Hi everyone!

I want to customize email templates. For example, the letter about registering new accounts contains little information. I have added custom fields and want the selected values to be displayed in the email.

As far as I understand, this is done using macro values. For example, {site_name}, {email_header} & etc. Where can I find a list of all the macros, or how can I create and use my own macros in email templates? For example, {job_titile}, {personal_status} or {field_of_activity}.

  • 1649
  • More
Replies (5)
    • Hello Andrey Bogomazov !

      The macros set is different for every email template. And processed via the PHP code. So for the introduction of the new variables you will need to edit the code of UNA which isn't recommended (problems with the automatic updates).

      • Thank you, LeonidS!

        Apparently, I have phrased my question incorrectly. UNA allows you to create your own shapes. I have supplemented the registration form with individual fields. Added a field of activity, a text block and a choice of user status.

        I need information from additional fields in the registration form to be displayed in a letter about new registrations after registration. How to do it? Now this information is not visible anywhere. I don't know what users are entering.

        Видимо, я неверно сформулировал мой вопрос. УНА позволяет создавать свои собственные формы. Я дополнил форму регистрации индивидуальными полями. Добавил сферу деятельности, текстовый блок и выбор статуса пользователя.

        Мне нужно, чтобы после регистрации в письме о новых регистрациях отражалась информация из дополнительных полей. Как это сделать? Сейчас эта информация нигде не видна. Я не знаю, что вводят пользователи.

        • Yes, I understand what do you mean. As you may see in the inc/classes/BxDolEmailTemplates.php file the replacement keys are defined in the PHP code as an example here:

          * @section example Example of usage

           *

           * Send an email using email templates:

           *

           * @code

           *

           *     // define custom template variables

           *     $aPlus = array();

           *     $aPlus['email'] = 'ktoto@example.com';

           *     $aPlus['conf_code'] = '123456';

           *     $aPlus['conf_link'] = BX_DOL_URL_ROOT . 'page.php?i=confirm-email&code=123456';

           *     $aPlus['conf_form_link'] = BX_DOL_URL_ROOT . 'page.php?i=confirm-email';

           *

           *     $aTemplate = BxDolEmailTemplates::getInstance()->parseTemplate('t_Confirmation', $aPlus); // get class instance and parse template

           *

           *     if ($aTemplate && sendMail('ktoto@example.com', $aTemplate['Subject'], $aTemplate['Body'])) // send email if template exists

           *         echo 'email was successfully sent';

           *     else

           *         echo 'email send failed';

           *

           * @endcode

           So new "terms" like your new field should be added in the PHP code only.

          • Thank you, LeonidS.

            So what's the point of adding individual (custom) fields to forms if information from them does not get anywhere?

            • Find the place where the sendMail function is called and add there the necessary parameters. For example, in what email do you want to add more fields?

              Login or Join to comment.