Force text/plain emails
-
I’m troubleshooting why emails that come through my ACFE forms get marked as spam, and one issue is that they’re all sent with content type text/html, but the body isn’t wrapped in an HTML tag.
I don’t need to send HTML emails, so I’m fine just changing the header from text/html to text/plain. However, I can’t get the submit_email_args hook to work. I’ve tried:
add_filter('acfe/form/submit_email_args', function($args, $form, $action){
$args['headers'] = str_replace('text/html', 'text/plain', $args['headers']);
$args['subject'] = 'Changed subject';
return $args;
}, 10, 3);And I’ve tried
add_filter('acfe/form/submit_form', function($form, $action){
$email = $action['email'];
$email['subject'] = 'New subject';
return $action;
}, 10, 2);Not only can I not get the headers to change, but even the subject line won’t change with this code in place. I don’t actually need to change the subject line, but I was trying to see if this was firing at all (it isn’t).
If someone can help me with the specific issue of the filter not firing, that would be great. But really, the larger issue is that everything is being sent as HTML emails, yet the body is not wrapped in an HTML tag. Maybe that’s more of a bug and I should open an issue about it in github, I don’t know.
You must be logged in to reply to this topic.