check-email-admin-status-display.php
110 lines
| 1 | <?php |
| 2 | // we have a nonce but we don't process the form here |
| 3 | // phpcs:ignoreFile |
| 4 | |
| 5 | $email_headers = isset( $_POST["checkemail_headers"] ) ? sanitize_text_field( wp_unslash($_POST["checkemail_headers"]) ) : 'auto'; |
| 6 | $checkemail_to = isset( $_POST["checkemail_to"] ) ? sanitize_email( wp_unslash( $_POST["checkemail_to"] ) ) : ''; |
| 7 | $checkemail_mime = isset( $_POST['checkemail_mime'] ) ? sanitize_text_field( wp_unslash($_POST['checkemail_mime']) ) : '1.0'; |
| 8 | $checkemail_type = isset( $_POST['checkemail_type'] ) ? sanitize_text_field( wp_unslash($_POST['checkemail_type']) ) : 'text/html; charset=iso-8859-1'; |
| 9 | $checkemail_from = isset( $_POST['checkemail_from'] ) ? sanitize_email( wp_unslash( $_POST['checkemail_from'] ) ) : $from_email; |
| 10 | $checkemail_cc = isset( $_POST['checkemail_cc'] ) ? sanitize_textarea_field( wp_unslash( $_POST['checkemail_cc'] ) ) : ''; |
| 11 | $checkemail_break = isset( $_POST['checkemail_break'] ) ? sanitize_text_field( wp_unslash( $_POST['checkemail_break'] ) ) : ''; |
| 12 | |
| 13 | ?> |
| 14 | |
| 15 | <div id="checkemail" class="wrap"> |
| 16 | <?php if ( isset( $_POST["checkemail_to"]) && ! empty( $_POST["checkemail_to"] ) ): ?> |
| 17 | <div class="updated"> |
| 18 | <?php if ( ! empty( $headers ) ): ?> |
| 19 | <p><?php esc_html_e( 'The test email has been sent by WordPress. Please note this does NOT mean it has been delivered. See', 'check_email' );?> |
| 20 | <a href=<? echo esc_url( "http://codex.wordpress.org/Function_Reference/wp_mail")?>> <?php esc_html_e( "wp_mail in the Codex", "check-email") ?></a> <?php esc_html_e( "for more information. The headers sent were :", 'check-email' ) ?> |
| 21 | </p> |
| 22 | |
| 23 | <pre><?php echo esc_textarea( str_replace( chr( 10 ), '\n' . "\n", str_replace( chr( 13 ), '\r', $headers ) ) ); ?></pre> |
| 24 | <?php else: ?> |
| 25 | <p><?php esc_html_e( 'Security check failed', 'check-email' ) ?></p> |
| 26 | <?php endif; ?> |
| 27 | </div> |
| 28 | <?php endif; ?> |
| 29 | <h2><?php esc_html_e( 'Check & Log Email', 'check-email' ) ?></h2><hr /> |
| 30 | |
| 31 | <?php if ( $phpmailer ) { ?> |
| 32 | |
| 33 | <h3><?php esc_html_e( 'Current mail settings', 'check-email' ) ?></h3> |
| 34 | <ul> |
| 35 | <?php if (isset($phpmailer->Mailer) && !empty($phpmailer->Mailer)): ?> |
| 36 | <li><?php esc_html_e( 'Mailer:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->Mailer ) ?></strong></li> |
| 37 | <?php endif; ?> |
| 38 | <?php if (isset($phpmailer->Sendmail) && !empty($phpmailer->Sendmail)): ?> |
| 39 | <li><?php esc_html_e( 'SendMail path:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->Sendmail ) ?></strong></li> |
| 40 | <?php endif; ?> |
| 41 | <?php if (isset($phpmailer->Host) && !empty($phpmailer->Host)): ?> |
| 42 | <li><?php esc_html_e( 'Host:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->Host ) ?></strong></li> |
| 43 | <?php endif; ?> |
| 44 | <?php if (isset($phpmailer->Port) && !empty($phpmailer->Port)): ?> |
| 45 | <li><?php esc_html_e( 'Port:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->Port ) ?></strong></li> |
| 46 | <?php endif; ?> |
| 47 | <?php if (isset($phpmailer->CharSet) && !empty($phpmailer->CharSet)): ?> |
| 48 | <li><?php esc_html_e( 'CharSet:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->CharSet ) ?></strong></li> |
| 49 | <?php endif; ?> |
| 50 | <?php if (isset($phpmailer->ContentType) && !empty($phpmailer->ContentType)): ?> |
| 51 | <li><?php esc_html_e( 'Content-Type:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->ContentType ) ?></strong></li> |
| 52 | <?php endif; ?> |
| 53 | </ul> |
| 54 | |
| 55 | <?php } ?> |
| 56 | |
| 57 | <h3><?php esc_html_e( 'Send a test email', 'check-email' ) ?></h3><hr /> |
| 58 | <form action="<?php echo esc_url( get_admin_url() ) . 'admin.php?page=check-email-status' ?>" method="post"> |
| 59 | <p> |
| 60 | <label for="checkemail_to"><?php esc_html_e( 'Send test email to', 'check-email' ); ?></label> |
| 61 | <input type="text" name="checkemail_to" id="checkemail_to" 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 | </div> |
| 110 |