*/ if ( ! defined( 'ABSPATH' ) ) { exit; } add_action( 'admin_menu', 'wp_mail_embed_showcase_admin_menu' ); function wp_mail_embed_showcase_admin_menu() { add_menu_page( 'WP Mail Embed Showcase', 'Mail Embed Showcase', 'manage_options', 'wp-mail-embed-showcase', 'wp_mail_embed_showcase_admin_page', 'dashicons-email-alt' ); } function wp_mail_embed_showcase_admin_page() { $message = ''; if ( isset( $_POST['submit'] ) ) { $admin_email = get_option( 'admin_email' ); $subject = 'WP Mail Embed Showcase'; $image_path1 = ABSPATH .'wp-admin/images/wordpress-logo.svg'; $image_path2 = ABSPATH .'wp-admin/images/w-logo-blue.png'; $cid1 = md5( $image_path1 ); $cid2 = md5( $image_path2 ); $email_body = ''; $email_body .= '

This is a test email with embedded images.

'; $email_body .= '

WordPress logo SVG:

'; $email_body .= 'WordPress Logo'; $email_body .= '

W logo Blue PNG:

'; $email_body .= 'W Logo'; $email_body .= ''; $headers = array( 'Content-Type: text/html; charset=UTF-8' ); $embeds = array( $image_path1, $image_path2, ); add_filter( 'wp_mail_embed_args', 'wp_mail_embed_showcase_svg_mime_type', 10, 2 ); $sent = wp_mail( $admin_email, $subject, $email_body, $headers, array(), $embeds ); remove_filter( 'wp_mail_embed_args', 'wp_mail_embed_showcase_svg_mime_type', 10 ); if ( $sent ) { $message = '

Test email sent successfully!

'; } else { $message = '

Failed to send the test email.

'; } } ?>

WP Mail Embed Showcase

Test email with embedded images to ().