-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathwp-mail-test.php
More file actions
27 lines (25 loc) · 918 Bytes
/
wp-mail-test.php
File metadata and controls
27 lines (25 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
/**
* Plugin Name: wp-mail-test.php
* Description: Used to send a test email to test the wp_mail function.
* Version: 1.0.0
* Status: Complete
* Type: mu-plugin
*
* Visit the media upload section to trigger the email.
*/
add_action('admin_init', 'send_test12345');
function send_test12345() {
global $pagenow;
if( current_user_can('administrator') && ($pagenow == 'upload.php')) {
echo "Test";
$current_date=date('m/d/Y h:i:s a', time());
$to = 'test@test.ca';
$subject = 'wp_mail test - '.$current_date;
$headers[] = 'From: Yellow <yellow@test.com>'. "\r\n";
$message = 'This is a test email using wp-content/mu-plugins/wm_mail.php';
#$headers[] = 'Cc: Blue <bluet@test.com>';
#$headers[] = 'Cc: yellow@test.com'; // note you can just use a simple email address
wp_mail( $to, $subject, $message, $headers);
}
}