check-email-admin-status-display.php
120 lines
| 1 | <?php |
| 2 | // we have a nonce but we don't process the form here |
| 3 | // phpcs:ignoreFile |
| 4 | // Exit if accessed directly |
| 5 | if( !defined( 'ABSPATH' ) ) |
| 6 | exit; |
| 7 | $email_headers = isset( $_POST["checkemail_headers"] ) ? sanitize_text_field( wp_unslash($_POST["checkemail_headers"]) ) : 'auto'; |
| 8 | $checkemail_to = isset( $_POST["checkemail_to"] ) ? sanitize_email( wp_unslash( $_POST["checkemail_to"] ) ) : ''; |
| 9 | $checkemail_mime = isset( $_POST['checkemail_mime'] ) ? sanitize_text_field( wp_unslash($_POST['checkemail_mime']) ) : '1.0'; |
| 10 | $checkemail_type = isset( $_POST['checkemail_type'] ) ? sanitize_text_field( wp_unslash($_POST['checkemail_type']) ) : 'text/html; charset=iso-8859-1'; |
| 11 | $checkemail_from = isset( $_POST['checkemail_from'] ) ? sanitize_email( wp_unslash( $_POST['checkemail_from'] ) ) : $from_email; |
| 12 | $checkemail_cc = isset( $_POST['checkemail_cc'] ) ? sanitize_textarea_field( wp_unslash( $_POST['checkemail_cc'] ) ) : ''; |
| 13 | $checkemail_break = isset( $_POST['checkemail_break'] ) ? sanitize_text_field( wp_unslash( $_POST['checkemail_break'] ) ) : ''; |
| 14 | |
| 15 | ?> |
| 16 | |
| 17 | <div id="checkemail" class="wrap"> |
| 18 | <?php if ( isset( $_POST["checkemail_to"]) && ! empty( $_POST["checkemail_to"] ) ): ?> |
| 19 | <div class="updated"> |
| 20 | <?php if ( ! empty( $headers ) ): ?> |
| 21 | <p><?php printf(esc_html__( 'The test email has been sent by WordPress. Please note this does NOT mean it has been delivered. See %1$swp_mail in the Codex%2$s for more information. The headers sent were :', 'check-email' ),'<a href="https://developer.wordpress.org/reference/functions/wp_mail/" target="_blank")>','</a>');?> |
| 22 | </p> |
| 23 | |
| 24 | <pre><?php echo esc_textarea( str_replace( chr( 10 ), '\n' . "\n", str_replace( chr( 13 ), '\r', $headers ) ) ); ?></pre> |
| 25 | <?php else: ?> |
| 26 | <p><?php esc_html_e( 'Security check failed', 'check-email' ) ?></p> |
| 27 | <?php endif; ?> |
| 28 | </div> |
| 29 | <?php endif; ?> |
| 30 | <h2><?php esc_html_e( 'Test Email', 'check-email' ) ?></h2><hr /> |
| 31 | |
| 32 | <?php if ( $phpmailer ) { ?> |
| 33 | |
| 34 | <h3><?php esc_html_e( 'Current mail settings', 'check-email' ) ?></h3> |
| 35 | <ul> |
| 36 | <?php if (isset($phpmailer->Mailer) && !empty($phpmailer->Mailer)): ?> |
| 37 | <li><?php esc_html_e( 'Mailer:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->Mailer ) ?></strong></li> |
| 38 | <?php endif; ?> |
| 39 | <?php if (isset($phpmailer->Sendmail) && !empty($phpmailer->Sendmail)): ?> |
| 40 | <li><?php esc_html_e( 'SendMail path:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->Sendmail ) ?></strong></li> |
| 41 | <?php endif; ?> |
| 42 | <?php if (isset($phpmailer->Host) && !empty($phpmailer->Host)): ?> |
| 43 | <li><?php esc_html_e( 'Host:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->Host ) ?></strong></li> |
| 44 | <?php endif; ?> |
| 45 | <?php if (isset($phpmailer->Port) && !empty($phpmailer->Port)): ?> |
| 46 | <li><?php esc_html_e( 'Port:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->Port ) ?></strong></li> |
| 47 | <?php endif; ?> |
| 48 | <?php if (isset($phpmailer->CharSet) && !empty($phpmailer->CharSet)): ?> |
| 49 | <li><?php esc_html_e( 'CharSet:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->CharSet ) ?></strong></li> |
| 50 | <?php endif; ?> |
| 51 | <?php if (isset($phpmailer->ContentType) && !empty($phpmailer->ContentType)): ?> |
| 52 | <li><?php esc_html_e( 'Content-Type:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->ContentType ) ?></strong></li> |
| 53 | <?php endif; ?> |
| 54 | </ul> |
| 55 | |
| 56 | <?php } ?> |
| 57 | |
| 58 | <h3><?php esc_html_e( 'Send a test email', 'check-email' ) ?></h3> |
| 59 | <form action="<?php echo esc_url( get_admin_url() ) . 'admin.php?page=check-email-status' ?>" method="post"> |
| 60 | <p> |
| 61 | <input type="text" name="checkemail_to" id="checkemail_to" placeholder="Enter an email" class="text" value="<?php echo esc_attr( $checkemail_to ) ?>"/> |
| 62 | </p> |
| 63 | <p> |
| 64 | <label for="checkemail_autoheaders"><?php esc_html_e( 'Use standard headers', 'check-email' ) ?></label> |
| 65 | <?php ?> |
| 66 | <input type="radio" id="checkemail_autoheaders" name="checkemail_headers" value="auto" <?php checked( $email_headers, 'auto' ) ?>/> |
| 67 | </p> |
| 68 | <div id="autoheaders" class="<?php echo ( $email_headers == 'custom' ? 'checkemail-hide' : '' ) ?>"> |
| 69 | <?php printf( esc_html__( 'MIME-Version: %s', 'check-email'), '1.0' ) ?><br /> |
| 70 | <?php printf( esc_html__( 'From: %s', 'check-email'), esc_html( $from_email ) ) ?><br /> |
| 71 | <?php printf( esc_html__( 'Content-Type: %s', 'check-email'), 'text/plain; charset="' . esc_html( get_option( 'blog_charset' ) ) . '"' ) ?> |
| 72 | </div> |
| 73 | <p> |
| 74 | <label for='checkemail_customheaders'><?php esc_html_e( 'Use custom headers', 'check-email' ) ?></label> |
| 75 | <input type="radio" id="checkemail_customheaders" name="checkemail_headers" value="custom" <?php echo (isset($_POST['checkemail_headers']) && $_POST['checkemail_headers'] == 'custom' ? 'checked="checked"' : '') ?>/> |
| 76 | </p> |
| 77 | <div id="customheaders" class="<?php echo ( !isset($_POST['checkemail_headers']) || $_POST['checkemail_headers'] == 'auto' ? 'checkemail-hide' : '' ) ?>"><br /> |
| 78 | <h3><?php esc_html_e( 'Set your custom headers below', 'check-email' ) ?></h3><hr /> |
| 79 | <p> |
| 80 | <label for="checkemail_mime"><?php esc_html_e( 'MIME Version', 'check-email' ) ?></label> |
| 81 | <input type="text" name="checkemail_mime" id="checkemail_mime" value="<?php echo esc_attr( $checkemail_mime ) ?>"/> |
| 82 | </p> |
| 83 | <p> |
| 84 | <label for="checkemail_type"><?php esc_html_e( 'Content type', 'check-email' ) ?></label> |
| 85 | <input type="text" name="checkemail_type" id="checkemail_type" value="<?php echo esc_attr( $checkemail_type ) ?>"/> |
| 86 | </p> |
| 87 | <p> |
| 88 | <label for="checkemail_from"><?php esc_html_e( 'From', 'check-email' ) ?></label> |
| 89 | <input type="text" name="checkemail_from" id="checkemail_from" value="<?php echo esc_attr( $checkemail_from ) ?>" class="text" /> |
| 90 | </p> |
| 91 | <p> |
| 92 | <label for="checkemail_cc"><?php esc_html_e( 'CC', 'check-email' ) ?></label> |
| 93 | <textarea name="checkemail_cc" id="checkemail_cc" cols="30" rows="4" class="text"><?php echo esc_textarea( $checkemail_cc ) ?></textarea> |
| 94 | </p> |
| 95 | <p> |
| 96 | <label for="checkemail_break_n"><?php esc_html_e( 'Header line break type', 'check-email' ) ?></label> |
| 97 | <input type="radio" name="checkemail_break" id="checkemail_break_n" value="\n" <?php checked( $checkemail_break, '\n' ) ?>/><?php esc_html_e('\n', 'check-email') ?> |
| 98 | <input type="radio" name="checkemail_break" id="checkemail_break_rn" value="\r\n" <?php checked( $checkemail_break, '\r\n' ) ?>/><?php esc_html_e('\r\n', 'check-email') ?> |
| 99 | </p> |
| 100 | </div> |
| 101 | |
| 102 | <?php wp_nonce_field( 'checkemail' ); ?> |
| 103 | |
| 104 | <p> |
| 105 | <label for="checkemail_go" class="checkemail-hide"><?php esc_html_e( 'Send', 'check-email' ) ?></label> |
| 106 | <input type="submit" name="checkemail_go" id="checkemail_go" class="button-primary" value="<?php esc_attr_e( 'Send test email', 'check-email' ) ?>" /> |
| 107 | </p> |
| 108 | </form> |
| 109 | |
| 110 | <div id="CKE_banner"> |
| 111 | <h2> |
| 112 | <img draggable="false" role="img" class="emoji" alt="👉" src="https://s.w.org/images/core/emoji/13.0.1/svg/1f449.svg"> |
| 113 | <?php esc_html_e('Suggest a new feature!', 'check-email') ?> |
| 114 | <img draggable="false" role="img" class="emoji" alt="👈" src="https://s.w.org/images/core/emoji/13.0.1/svg/1f448.svg"> |
| 115 | </h2> |
| 116 | <p><?php esc_html_e('Help us build the next set of features for Check & Log Email. Tell us what you think and we will make it happen!', 'check-email') ?></p> |
| 117 | <a target="_blank" rel="noreferrer noopener" href="https://check-email.tech/contact/" class="button button-primary button-hero"><?php esc_html_e('Click here', 'check-email') ?></a> |
| 118 | </div> |
| 119 | </div> |
| 120 |