Reply To: Problem with sending emails

Home Forums Front End PM PRO Problem with sending emails Reply To: Problem with sending emails

test programmer

I’ve tried this:

add_filter( 'fep_filter_before_email_send', 'change_email_subject', 10, 3 );

function change_email_subject($content, $post, $user_email)
  $current_language = apply_filters( 'wpml_current_language', NULL );

  $language = get_user_meta( fep_get_userdata( $user_email, 'ID', 'email'), 'icl_admin_language', true );

  // set language of user
  do_action( 'wpml_switch_language', $language );

  $subject = "";

  if($post->post_type == "fep_message")
      $subject = sprintf( __('ZOUTE GRAND PRIX®: New message', 'zoute_theme' ));

  $content['subject'] = $subject;

  do_action( 'wpml_switch_language', $current_language );

  return $content;

When I try to dump the $content before returning it, the subject is changed correctly. The content of the message itself not (but is changed afterwards with template in /emails folder).

But when I receive the email, the subject is not changed. It’s overwritten by the subject configured in backoffice.

Why doesn’t it work?