WordPress.org

Make WordPress Core

Ticket #33787: wp-test-email.php

File wp-test-email.php, 1.2 KB (added by UmeshSingla, 5 years ago)

Plugin to test the issue

Line 
1<?php
2/**
3 * @package WP_Test_HTML_Email
4 * @version 1.0
5 */
6/*
7Plugin Name: WP Test HTML Email
8Plugin URI: http://wordpress.org/extend/plugins/wp-test-html-email/
9Description: This is just a demo plugin for core ticket
10Author: Umesh Kumar
11Version: 1.0
12Author URI: http://codechutney.com
13*/
14function wp_test_html_email() {
15        $content = __( "<br /> <b>Content being sent: </b>Payment Amount: &#x20ac;2.00 EUR" );
16        print_r( $content ); ?>
17        <br/><br/>
18        <form method="post">
19                <label>Email:<input type="text" name="test_email" value=""/></label>
20                <input type="submit" name="wp_send_test_email" id="wp_send_test_email" class="button button-primary button-large" value="Send test email">
21        </form>
22        <?php
23        if ( $_POST['wp_send_test_email'] && !empty($_POST['test_email']) ) {
24                $mail = wp_mail( $_POST['test_email'], "Test Email", $content );
25                if( $mail ) {
26                        echo "Email sent to: " . $_POST['test_email'] ;
27                }
28        }
29}
30
31function wp_test_html_email_page() {
32        add_management_page( "Euro sign converted to Emoji URL", "Test HTML Email", 'manage_options', 'wp-test-html-email', "wp_test_html_email" );
33}
34
35add_action( 'admin_menu', 'wp_test_html_email_page' );
36add_filter( 'wp_mail_content_type', 'set_content_type' );
37function set_content_type( $content_type ) {
38        return 'text/html';
39}
40
41?>