I'm trying to create a mailing based on a template through the CiviCRM API.
Here's my code:
$params = array(
'name' => $subject,
'msg_template_id'=> 87,
'created_id' => 1,
'header_id' => 1,
'footer_id' => 17,
'from_email' => $from,
'groups' => array(
'include' => array(
'0' => 893,
),
),
'mailings' => array(
'include' => array(),
'exclude' => array(),
),
'options' => array(
'force_rollback' => 1,
),
'api.mailing_job.create' => 1,
'api.MailingRecipients.get' => array(
'mailing_id' => '$value.id',
'api.contact.getvalue' => array(
'return' => 'display_name',
),
'api.email.getvalue' => array(
'return' => 'email',
),
),
);
$result = civicrm_api3('Mailing', 'create', $params);
In mailing everything is correct, the template chosen in the settings is the correct one. But there is no content in the mail.
How to make the content of the mail automatically filled by the content of the template and not from the body_html parameter?