Score:0

Load webform handler to change to_mail

I have a contact form with three handlers, on to send mail to admin, second to sales team and the last one to the one who have filled out the form.

I would like to change the to_mail address programatically, config sync is not allowed.

Is there any way to load webform handler and set the to address programatically.

function efx_send_mail_update_9953() {
 $config = \Drupal::configFactory()->getEditable('webform.webform.contact'); // contact is the webform
 print_r($config);
 //die;
 $config_key = 'handlers.email_confirmation.to_mail'; // email_confirmation is the handler
 $config->set($config_key, '[email protected]')->save();*/
}
leymannx avatar
ne flag
Google: https://gist.github.com/mamesaye/1be4dd33ba37f33e661f0a3434de2f52
Fazeela MukhappillyAboobacker avatar
Thank you. it worked for me.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.