Documentation

SetMailTemplate

array
CForm::SetMailTemplate(
 int form_id,
 string add_template = "Y",
 string old_form_sid = ""
)

The method creates or updates the type of mail event for the [link=90284#form]web form[/link]. If required, mail templates can be created. This method returns the array of IDs for the newly created mail templates. Non-static method.

Note
When creating a new mail event type, the symbol ID of this type is set as FORM_FILLING_ web form ID.

Method parameters

Parameter Description Available from version
form_id Web form ID. Mail event type must be created or updated for this form. Deleted from 3.3.10 version onwards
add_template If set to "Y", mail templates will be created for the updated or newly created mail event type.

Optional parameter. Set to "Y" by default (create mail templates).
old_form_sid If a web form ID is set in this parameter, all mail templates, belonging to this web form will be associated to the newly created type of mail event. Generally, this parameter is used when editing the web form when the ID is changed.

Optional parameter. Empty by default (mail templates are not associated to the new main event type).
4.0.4
old_varname Optional parameter. Deleted from 4.0.4 version and older
web_form_id Web form ID. Mail event type must be created or updated for this web form.
bReturnFullInfo Optional parameter. False by default.

See Also

  • [link=89606]Mail system[/link]
  • [link=90320]CForm::Set[/link]

Examples of use

<?
// add a new mail event type for the web form
// create mail templates 

$arTemplates = CForm::SetMailTemplate($FORM_ID);

// associate newly created mail templates with this web form 

CForm::Set(array("arMAIL_TEMPLATE" => $arTemplates), $FORM_ID);
?>


© «Bitrix24», 2001-2024
Up