| 1 |
<div class="postbox"> |
| 2 |
<div class="inside"> |
| 3 |
<h3><?php _e( 'Send Test Email', 'erp' ); ?></h3> |
| 4 |
|
| 5 |
<?php |
| 6 |
$email_settings = get_option( 'erp_settings_erp-email_general', [] ); |
| 7 |
|
| 8 |
if ( isset( $_GET['sent'] ) ) { |
| 9 |
erp_html_show_notice( __( 'The test email has been sent by WordPress. Please note this does NOT mean it has been delivered.', 'erp' ) ); |
| 10 |
} |
| 11 |
?> |
| 12 |
|
| 13 |
<form method="post" action="<?php echo admin_url( 'admin.php?page=erp-tools&tab=misc' ); ?>" id="erp-test-email-form"> |
| 14 |
|
| 15 |
<table class="form-table"> |
| 16 |
<tbody> |
| 17 |
<tr> |
| 18 |
<th> |
| 19 |
<label for="to"><?php _e( 'To', 'erp' ); ?> <span class="required">*</span></label> |
| 20 |
</th> |
| 21 |
<td> |
| 22 |
<?php erp_html_form_input([ |
| 23 |
'type' => 'email', |
| 24 |
'name' => 'to', |
| 25 |
'value' => wp_get_current_user()->user_email, |
| 26 |
'placeholder' => 'recipient@domain.com', |
| 27 |
'custom_attr' => [ |
| 28 |
'size' => 40 |
| 29 |
] |
| 30 |
]); ?> |
| 31 |
</td> |
| 32 |
</tr> |
| 33 |
<tr> |
| 34 |
<th> |
| 35 |
<label for="from"><?php _e( 'From', 'erp' ); ?></label> |
| 36 |
</th> |
| 37 |
<td> |
| 38 |
<?php |
| 39 |
global $current_user; |
| 40 |
|
| 41 |
$from_name = ( ! empty( $email_settings['from_name'] ) ) ? $email_settings['from_name'] : $current_user->display_name; |
| 42 |
$from_email = ( ! empty( $email_settings['from_email'] ) ) ? $email_settings['from_email'] : get_option( 'admin_email' ); |
| 43 |
|
| 44 |
erp_html_form_input([ |
| 45 |
'type' => 'text', |
| 46 |
'name' => 'from', |
| 47 |
'value' => sprintf( '%s <%s>', $from_name, $from_email ), |
| 48 |
'custom_attr' => [ |
| 49 |
'readonly' => 'readonly', |
| 50 |
'size' => 40 |
| 51 |
] |
| 52 |
]); |
| 53 |
?> |
| 54 |
</td> |
| 55 |
</tr> |
| 56 |
<tr> |
| 57 |
<th> |
| 58 |
<label for="body"><?php _e( 'Message', 'erp' ); ?></label> |
| 59 |
</th> |
| 60 |
<td> |
| 61 |
<?php erp_html_form_input([ |
| 62 |
'type' => 'textarea', |
| 63 |
'name' => 'body', |
| 64 |
'placeholder' => __( 'Leave blank to send default texts', 'erp' ), |
| 65 |
'custom_attr' => [ |
| 66 |
'cols' => 45, |
| 67 |
'rows' => 6 |
| 68 |
] |
| 69 |
]); ?> |
| 70 |
</td> |
| 71 |
</tr> |
| 72 |
</tbody> |
| 73 |
</table> |
| 74 |
|
| 75 |
<?php wp_nonce_field( 'erp-test-email-nonce' ); ?> |
| 76 |
<?php submit_button( __( 'Send Email', 'erp' ), 'primary', 'erp_send_test_email' ); ?> |
| 77 |
</form> |
| 78 |
</div><!-- .inside --> |
| 79 |
</div><!-- .postbox --> |
| 80 |
|