Skip to content

Instantly share code, notes, and snippets.

@wpmudev-sls
Last active February 22, 2024 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpmudev-sls/d8da73be0993a0859996a4f912bce859 to your computer and use it in GitHub Desktop.
Save wpmudev-sls/d8da73be0993a0859996a4f912bce859 to your computer and use it in GitHub Desktop.
[Forminator Pro] - Fix email log issue in Microsoft Azure email logger plugin
<?php
/**
* Plugin Name: [Forminator Pro] Fix email log issue with Microsoft Azure email logging
* Description: Fix email log issue with Microsoft Azure email logging plugin.
* Author: Prashant @ WPMUDEV
* Task: SLS-5796
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
add_filter( 'wp_mail', 'wpmudev_azure_forminator_fixes', 10, 1 );
function wpmudev_azure_forminator_fixes( $args ) {
if ( is_array( $args['headers'] ) ) {
foreach ( $args['headers'] as $key => $value ) {
if ( strpos( $value, 'X-FORMINAT-AZURE' ) !== false ) {
if ( is_array( $args['to'] ) ) {
$args['to'] = implode( ', ', $args['to'] );
}
}
}
}
return $args;
}
add_filter( 'forminator_custom_form_mail_admin_headers', 'wpmudev_change_forminator_header_azure', 10, 5 );
function wpmudev_change_forminator_header_azure( $headers, $custom_form, $data, $entry, $cls ) {
$headers[] = 'X-FORMINAT-AZURE : true';
return $headers;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment