S
S
Spider84112018-09-07 09:04:04
1C-Bitrix
Spider8411, 2018-09-07 09:04:04

Bitrix - Sending a message to different addresses from one web form - did I do it right?

Hello.
I started working with Bitrix not so long ago, having programming experience in Drupal/Wordpress and others. Therefore, I would like to clarify whether I correctly solved the problem.
In general, you need to have a component that displays a web form and accepts an additional email address as input, to which it will send a message. After reading about web forms and mail templates, I realized that I need to somehow dynamically create or change a mail template, replacing the address in it. At first, I just wanted to replace the address in the template before sending, but then I thought that theoretically there could be a conflict here - if we allow several messages to be sent simultaneously from the site. Of course, the site is not highly loaded, but somehow I didn’t want to leave such a roughness.
I ended up doing this. When sending a message, I create a new mail template from the code, fill in all its fields, except for the address from the existing one. The address comes from a parameter.
Isn't it a smart decision? Maybe I'm breaking into an open door and there is some standard way or component?
And one more question. Quite often in component template I need some parameter from outside. I tried passing the variable just as an extra parameter to the component and it worked. Is this a valid solution?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita, 2018-09-07
@Rema1ns

If the additional address is static, then you can simply create 1 more template for the web form.
If not, create a hidden field, define a new component parameter, write an additional email in the field, since there is a field, then it will be in the template, then simply add the value of this field to the list of recipients, or a new template with this recipient.
It all depends on where it comes from and how it gets into the additional mail component.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question