| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Email page. |
| 5 |
* |
| 6 |
* @link https://nl.wordpress.org/plugins/check-email/ |
| 7 |
* @link https://plugins.trac.wordpress.org/browser/check-email/trunk/check-email.php |
| 8 |
*/ |
| 9 |
|
| 10 |
?> |
| 11 |
<div class="wrap"> |
| 12 |
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1> |
| 13 |
|
| 14 |
<h2><?php esc_html_e( 'Current mail settings', 'pronamic-client' ); ?></h2> |
| 15 |
|
| 16 |
<table class="pronamic-status-table widefat striped" cellspacing="0"> |
| 17 |
<tbody> |
| 18 |
<tr> |
| 19 |
<th scope="row"> |
| 20 |
<?php esc_html_e( 'SendMail path (UNIX)', 'pronamic-client' ); ?> |
| 21 |
</th> |
| 22 |
<td> |
| 23 |
<code><?php echo esc_html( ini_get( 'sendmail_path' ) ); ?></code> |
| 24 |
</td> |
| 25 |
</tr> |
| 26 |
<tr> |
| 27 |
<th scope="row"> |
| 28 |
<?php esc_html_e( 'SMTP server (Windows)', 'pronamic-client' ); ?> |
| 29 |
</th> |
| 30 |
<td> |
| 31 |
<code><?php echo esc_html( ini_get( 'SMTP' ) ); ?></code> |
| 32 |
</td> |
| 33 |
</tr> |
| 34 |
<tr> |
| 35 |
<th scope="row"> |
| 36 |
<?php esc_html_e( 'SMTP port (Windows)', 'pronamic-client' ); ?> |
| 37 |
</th> |
| 38 |
<td> |
| 39 |
<code><?php echo esc_html( ini_get( 'smtp_port' ) ); ?></code> |
| 40 |
</td> |
| 41 |
</tr> |
| 42 |
<tr> |
| 43 |
<th scope="row"> |
| 44 |
<?php esc_html_e( 'Add X-header', 'pronamic-client' ); ?> |
| 45 |
</th> |
| 46 |
<td> |
| 47 |
<code><?php echo esc_html( ini_get( 'mail.add_x_header' ) ); ?></code> |
| 48 |
</td> |
| 49 |
</tr> |
| 50 |
<tr> |
| 51 |
<th scope="row"> |
| 52 |
<?php |
| 53 |
|
| 54 |
printf( |
| 55 |
/* translators: %s: <code>wp_mail()</code> */ |
| 56 |
__( 'Function %s location', 'pronamic-client' ), |
| 57 |
'<code>wp_mail()</code>' |
| 58 |
); |
| 59 |
|
| 60 |
?> |
| 61 |
</th> |
| 62 |
<td> |
| 63 |
<?php |
| 64 |
|
| 65 |
$reflection_wp_mail = new ReflectionFunction( 'wp_mail' ); |
| 66 |
|
| 67 |
printf( |
| 68 |
/* translators: 1: filename, 2: line */ |
| 69 |
__( 'In %1$s on line %2$s.', 'pronamic-client' ), |
| 70 |
'<code>' . $reflection_wp_mail->getFileName() . '</code>', |
| 71 |
'<code>' . $reflection_wp_mail->getStartLine() . '</code>' |
| 72 |
); |
| 73 |
|
| 74 |
?> |
| 75 |
</td> |
| 76 |
</tr> |
| 77 |
</tbody> |
| 78 |
</table> |
| 79 |
|
| 80 |
<h2><?php esc_html_e( 'Send a test email', 'pronamic-client' ); ?></h2> |
| 81 |
|
| 82 |
<?php |
| 83 |
|
| 84 |
// phpcs:ignore WordPress.Security.NonceVerification |
| 85 |
$message = array_key_exists( 'message', $_GET ) ? \sanitize_text_field( \wp_unslash( $_GET['message'] ) ) : ''; |
| 86 |
|
| 87 |
if ( 'pronamic_client_test_email_sent_no' === $message ) : |
| 88 |
?> |
| 89 |
|
| 90 |
<div class="error"> |
| 91 |
<p> |
| 92 |
<?php esc_html_e( 'The test email has not been sent by WordPress.', 'pronamic-client' ); ?> |
| 93 |
</p> |
| 94 |
</div> |
| 95 |
|
| 96 |
<?php |
| 97 |
endif; |
| 98 |
|
| 99 |
if ( 'pronamic_client_test_email_sent_yes' === $message ) : |
| 100 |
?> |
| 101 |
|
| 102 |
<div class="updated"> |
| 103 |
<p> |
| 104 |
<?php esc_html_e( 'The test email has been sent by WordPress. Please note this does not mean it has been delivered.', 'pronamic-client' ); ?> |
| 105 |
</p> |
| 106 |
</div> |
| 107 |
|
| 108 |
<?php endif; ?> |
| 109 |
|
| 110 |
<p> |
| 111 |
<?php |
| 112 |
|
| 113 |
printf( |
| 114 |
/* translators: %s: <a href="https://www.mail-tester.com">mail-tester.com</a> */ |
| 115 |
__( 'Use a service like %s to test if this WordPress installation is sending emails.', 'pronamic-client' ), |
| 116 |
sprintf( |
| 117 |
'<a href="%s">%s</a>', |
| 118 |
esc_url( 'https://www.mail-tester.com/' ), |
| 119 |
esc_html( 'mail-tester.com' ) |
| 120 |
) |
| 121 |
); |
| 122 |
|
| 123 |
?> |
| 124 |
</p> |
| 125 |
|
| 126 |
<form method="post" action=""> |
| 127 |
<?php |
| 128 |
|
| 129 |
$email = (object) [ |
| 130 |
'from' => '', |
| 131 |
'to' => '', |
| 132 |
'subject' => \sprintf( |
| 133 |
/* translators: %s: site url */ |
| 134 |
\__( 'Test email from %s', 'pronamic-client' ), |
| 135 |
\get_bloginfo( 'url' ) |
| 136 |
), |
| 137 |
'message' => \sprintf( |
| 138 |
/* translators: %s: site url */ |
| 139 |
__( 'This test email proves that your WordPress installation at %s can send emails.', 'pronamic-client' ), |
| 140 |
\get_bloginfo( 'url' ) |
| 141 |
), |
| 142 |
'headers' => [], |
| 143 |
]; |
| 144 |
|
| 145 |
?> |
| 146 |
<table class="form-table"> |
| 147 |
<tbody> |
| 148 |
<tr> |
| 149 |
<th scope="row"> |
| 150 |
<label for="pronamic_client_test_email_to"><?php esc_html_e( 'Send To', 'pronamic-client' ); ?></label> |
| 151 |
</th> |
| 152 |
<td> |
| 153 |
<input name="pronamic_client_test_email[to]" type="email" id="pronamic_client_test_email_to" value="<?php echo \esc_attr( $email->to ); ?>" class="regular-text" required="required"/> |
| 154 |
</td> |
| 155 |
</tr> |
| 156 |
<tr> |
| 157 |
<th scope="row"> |
| 158 |
<label for="pronamic_client_test_email_from"><?php esc_html_e( 'From Email', 'pronamic-client' ); ?></label> |
| 159 |
</th> |
| 160 |
<td> |
| 161 |
<input name="pronamic_client_test_email[from]" type="email" id="pronamic_client_test_email_from" value="<?php echo \esc_attr( $email->from ); ?>" class="regular-text" /> |
| 162 |
|
| 163 |
<p class="description"><?php \esc_html_e( 'Leave empty to use WordPress default sender.', 'pronamic-client' ); ?></p> |
| 164 |
</td> |
| 165 |
</tr> |
| 166 |
<tr> |
| 167 |
<th scope="row"> |
| 168 |
<label for="pronamic_client_test_email_subject"><?php esc_html_e( 'Subject', 'pronamic-client' ); ?></label> |
| 169 |
</th> |
| 170 |
<td> |
| 171 |
<input name="pronamic_client_test_email[subject]" type="text" id="pronamic_client_test_email_subject" value="<?php echo \esc_attr( $email->subject ); ?>" class="regular-text" required="required" /> |
| 172 |
</td> |
| 173 |
</tr> |
| 174 |
<tr> |
| 175 |
<th scope="row"> |
| 176 |
<label for="pronamic_client_test_email_message"><?php esc_html_e( 'Message', 'pronamic-client' ); ?></label> |
| 177 |
</th> |
| 178 |
<td> |
| 179 |
<textarea name="pronamic_client_test_email[message]" id="pronamic_client_test_email_message" cols="60" rows="4" required="required"><?php echo \esc_textarea( $email->message ); ?></textarea> |
| 180 |
</td> |
| 181 |
</tr> |
| 182 |
<tr> |
| 183 |
<th scope="row"> |
| 184 |
<label for="pronamic_client_test_email_headers"><?php esc_html_e( 'Headers', 'pronamic-client' ); ?></label> |
| 185 |
</th> |
| 186 |
<td> |
| 187 |
<textarea name="pronamic_client_test_email[headers]" id="pronamic_client_test_email_headers" cols="60" rows="4"><?php echo \esc_textarea( implode( "\r\n", $email->headers ) ); ?></textarea> |
| 188 |
</td> |
| 189 |
</tr> |
| 190 |
</tbody> |
| 191 |
</table> |
| 192 |
|
| 193 |
<?php |
| 194 |
|
| 195 |
/** |
| 196 |
* Submit button. |
| 197 |
* |
| 198 |
* @link https://developer.wordpress.org/reference/functions/submit_button/ |
| 199 |
* @link https://plugins.trac.wordpress.org/browser/check-email/trunk/check-email.php#L177 |
| 200 |
*/ |
| 201 |
submit_button( |
| 202 |
__( 'Send test email', 'pronamic-client' ), |
| 203 |
'primary', |
| 204 |
'pronamic_client_send_test_email' |
| 205 |
); |
| 206 |
|
| 207 |
/** |
| 208 |
* Nonce. |
| 209 |
* |
| 210 |
* @link https://developer.wordpress.org/reference/functions/wp_nonce_field/ |
| 211 |
*/ |
| 212 |
wp_nonce_field( |
| 213 |
'pronamic_client_send_test_email', |
| 214 |
'pronamic_client_send_test_email_nonce' |
| 215 |
); |
| 216 |
|
| 217 |
?> |
| 218 |
</form> |
| 219 |
|
| 220 |
<h2><?php esc_html_e( 'Tools', 'pronamic-client' ); ?></h2> |
| 221 |
|
| 222 |
<table class="pronamic-status-table widefat striped" cellspacing="0"> |
| 223 |
<thead> |
| 224 |
<tr> |
| 225 |
<th scope="col"> |
| 226 |
<?php esc_html_e( 'Title', 'pronamic-client' ); ?> |
| 227 |
</th> |
| 228 |
<th scope="col"> |
| 229 |
<?php esc_html_e( 'Link', 'pronamic-client' ); ?> |
| 230 |
</th> |
| 231 |
</tr> |
| 232 |
</thead> |
| 233 |
|
| 234 |
<tbody> |
| 235 |
<tr> |
| 236 |
<th scope="row"> |
| 237 |
<?php esc_html_e( 'mail-tester.com', 'pronamic-client' ); ?> |
| 238 |
</th> |
| 239 |
<td> |
| 240 |
<a href="https://www.mail-tester.com/">https://www.mail-tester.com/</a> |
| 241 |
</td> |
| 242 |
</tr> |
| 243 |
<tr> |
| 244 |
<th scope="row"> |
| 245 |
<?php esc_html_e( 'mail-tester.com/spf-dkim-check', 'pronamic-client' ); ?> |
| 246 |
</th> |
| 247 |
<td> |
| 248 |
<a href="https://www.mail-tester.com/spf-dkim-check">https://www.mail-tester.com/spf-dkim-check</a> |
| 249 |
</td> |
| 250 |
</tr> |
| 251 |
<tr> |
| 252 |
<th scope="row"> |
| 253 |
<?php esc_html_e( 'Dig (DNS lookup) - G Suite toolbox', 'pronamic-client' ); ?> |
| 254 |
</th> |
| 255 |
<td> |
| 256 |
<a href="https://toolbox.googleapps.com/apps/dig/">https://toolbox.googleapps.com/apps/dig/</a> |
| 257 |
</td> |
| 258 |
</tr> |
| 259 |
<tr> |
| 260 |
<th scope="row"> |
| 261 |
<?php esc_html_e( 'SPF Record Testing Tools', 'pronamic-client' ); ?> |
| 262 |
</th> |
| 263 |
<td> |
| 264 |
<a href="https://www.kitterman.com/spf/validate.html">https://www.kitterman.com/spf/validate.html</a> |
| 265 |
</td> |
| 266 |
</tr> |
| 267 |
<tr> |
| 268 |
<th scope="row"> |
| 269 |
<?php esc_html_e( 'dmarcian\'s SPF Record Checker', 'pronamic-client' ); ?> |
| 270 |
</th> |
| 271 |
<td> |
| 272 |
<a href="https://dmarcian.com/spf-survey/">https://dmarcian.com/spf-survey/</a> |
| 273 |
</td> |
| 274 |
</tr> |
| 275 |
<tr> |
| 276 |
<th scope="row"> |
| 277 |
<?php esc_html_e( 'DMARC Analyzer - DKIM record Checker', 'pronamic-client' ); ?> |
| 278 |
</th> |
| 279 |
<td> |
| 280 |
<a href="https://www.dmarcanalyzer.com/dkim/dkim-check/">https://www.dmarcanalyzer.com/dkim/dkim-check/</a> |
| 281 |
</td> |
| 282 |
</tr> |
| 283 |
<tr> |
| 284 |
<th scope="row"> |
| 285 |
<?php esc_html_e( 'DKIMValidator — DKIM, SPF, SpamAssassin validator', 'pronamic-client' ); ?> |
| 286 |
</th> |
| 287 |
<td> |
| 288 |
<a href="https://dkimvalidator.com/">https://dkimvalidator.com/</a> |
| 289 |
</td> |
| 290 |
</tr> |
| 291 |
</tbody> |
| 292 |
</table> |
| 293 |
</div> |
| 294 |
|