Because of the work-in-progress support of formatted text fields in the Rules module, the support for those fields in mimemail was reverted: https://www.drupal.org/node/1304332.

Removing the support makes sense because we don't want to break things for existing users. But this created a new problem: it makes it harder to "unofficialy" use formatted text fields. The people working on this patch for example: https://www.drupal.org/node/1304332, would be helped by having mimemail support formatted text fields.

The reverted patch did three things:

- set the body type of the mimemail action to text_formatted
- set the body type of the mimemail_to_users_of_role action to text_formatted
- use $body['value'] instead of $body

What I propose to be merged in a future release of mimemail:

- use $body['value'] instead of $body if $body['value'] is set
- use $body otherwise, so we won't break things for users not using text_formatted

Users can then easily set the body type of the actions in a custom module:

/**
 * Make the body field of the mail rules a html field.
 *
 * @param array $actions
 *   Array where the body is changed to text_formatted.
 */
function HOOK_rules_action_info_alter(&$actions) {
  if (isset($actions['mimemail']['parameter']['body']['type'])) {
    $actions['mimemail']['parameter']['body']['type'] = 'text_formatted';
  }

  if (isset($actions['mimemail_to_users_of_role']['parameter']['body']['type'])) {
    $actions['mimemail_to_users_of_role']['parameter']['body']['type'] = 'text_formatted';
  }
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jsst created an issue. See original summary.

Status: Needs review » Needs work

The last submitted patch, allow-formatted-text-in-mail-action.diff, failed testing. View results