Home computickets Bitrix. How to get the html code of an email from the...

Bitrix. How to get the html code of an email from the email template before sending it?

Author

Date

Category

Before sending a letter, attach a pdf file of the same letter. question. how to get the html code of the letter before sending it so that everything is already substituted there?


Answer 1, authority 100%

Event OnBeforeEventSend , but you have to substitute the values ​​first

Example:

AddEventHandler ('main', 'OnBeforeEventSend', Array ("MyForm", "my_OnBeforeEventSend"));
class MyForm
{
  function my_OnBeforeEventSend ($ arFields, $ arTemplate)
  {
     // get the message
     $ mess = $ arTemplate ["MESSAGE"];
     foreach ($ arFields as $ keyField = & gt; $ arField)
      $ mess = str_replace ('#'. $ keyField. '#', $ arField, $ mess); // substitute values ​​into the template
  }
}

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions