Changeset 1542298
- Timestamp:
- 11/28/2016 09:44:45 PM (9 years ago)
- Location:
- inesta-send-mail-copy/trunk
- Files:
-
- 4 edited
-
in_wpmail_copy.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
src/Inesta/MailCopy/Admin/Admin.php (modified) (6 diffs)
-
src/Inesta/MailCopy/MailHandler.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
inesta-send-mail-copy/trunk/in_wpmail_copy.php
r1539742 r1542298 3 3 * Plugin Name: Inesta Send Mail Copy 4 4 * Plugin URI: https://inesta.nl 5 * Description: Sends a copy o f every e-mail send via WordPress to an e-mail address.5 * Description: Sends a copy or BCC of every e-mail send via WordPress to an e-mail address. 6 6 * Author: Inesta 7 7 * Author URI: https://inesta.nl 8 8 * Text Domain: in_mc 9 9 * Domain Path: /languages 10 * Version: 0.1.010 * Version: 1.0.1 11 11 * 12 12 * @package In_wpmail_copy -
inesta-send-mail-copy/trunk/readme.txt
r1540487 r1542298 1 === ===Inesta Send Mail Copy ===1 === Inesta Send Mail Copy === 2 2 Contributors: roelv 3 3 Donate link: https://inesta.nl … … 5 5 Requires at least: 3.7 6 6 Tested up to: 4.7-alpha-38178-src 7 Stable tag: 1.0 7 Stable tag: 1.0.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 30 30 == Frequently Asked Questions == 31 31 32 = A question that someone might have=32 = How do I see the original to address = 33 33 34 An answer to that question.34 You should use the BCC option. Then the original sender is shown in the TO field. 35 35 36 = What about foo bar? =37 38 Answer to foo bar dilemma.39 36 40 37 == Screenshots == 41 38 42 1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from 43 the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets 44 directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png` 45 (or jpg, jpeg, gif). 46 2. This is the second screen shot 39 == Changelog == 47 40 48 == Changelog == 41 = 1.0.1 = 42 * Shows the original input again. 43 * Addes support to send BCC 49 44 50 45 = 1.0 = 51 46 * First version! 52 * Handles one e-mail address to send copies to === 53 Contributors: (this should be a list of wordpress.org userid's) 54 Donate link: https://inesta.nl 55 Tags: email, admin 56 Requires at least: 3.7 57 Tested up to: 4.7-alpha-38178-src 58 Stable tag: 1.0 59 License: GPLv2 or later 60 License URI: http://www.gnu.org/licenses/gpl-2.0.html 61 62 Sends a copy of every e-mail send via WordPress to an e-mail address. 63 64 == Description == 65 66 This plugin adds the functionality to send a copy of every mail send by WordPress. 67 68 Note 1: Even mails which include passwords or other privacy sensitive information are send to the entered e-mail address. 69 70 Note 2: If a plugin uses there own method of the PHP mail function to send e-mails this plugin cannot send a copy. 71 72 == Installation == 73 74 This section describes how to install the plugin and get it working. 75 76 1. Download the plugin. 77 1. Upload `Inesta Mail Copy` to the `/wp-content/plugins/` directory 78 1. Activate the plugin through the 'Plugins' menu in WordPress 79 1. Under `Settings` -> `Mail Copy` you can now specify an e-mail address 80 81 == Frequently Asked Questions == 82 83 = A question that someone might have = 84 85 An answer to that question. 86 87 = What about foo bar? = 88 89 Answer to foo bar dilemma. 90 91 == Screenshots == 92 93 1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from 94 the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets 95 directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png` 96 (or jpg, jpeg, gif). 97 2. This is the second screen shot 98 99 == Changelog == 100 101 = 1.0 = 102 * First version! 103 * Handles one e-mail address to send copies to 47 * Handles one e-mail address to send copies to. -
inesta-send-mail-copy/trunk/src/Inesta/MailCopy/Admin/Admin.php
r1539742 r1542298 26 26 ); 27 27 28 register_setting( 29 'in_mc_option_group', // Option group 30 'in_mc_option_bcc', // Option name 31 [ $this, 'sanitize' ] // Sanitize 32 ); 33 28 34 add_settings_section( 29 35 'setting_section_id', // ID … … 41 47 ); 42 48 49 add_settings_field( 50 'bcc_use', 51 __( 'Use BCC instead of copy', 'in_mc' ), 52 [ $this, 'bcc_use_callback' ], 53 'in-mc-setting-admin', 54 'setting_section_id' 55 ); 56 43 57 } 44 58 … … 49 63 public function create_admin_page() { 50 64 // Set class property 51 $this->options = get_option( 'in_mc_option s' );65 $this->options = get_option( 'in_mc_option_bcc' ); 52 66 53 67 ?> … … 77 91 ) { 78 92 93 $new_input = array(); 79 94 if ( isset( $input['bcc'] ) ) { 80 95 $new_input['bcc'] = sanitize_text_field( $input['bcc'] ); 96 } 97 if ( isset( $input['bcc_use'] ) ) { 98 $new_input['bcc_use'] = sanitize_text_field( $input['bcc_use'] ); 81 99 } 82 100 … … 96 114 */ 97 115 public function bcc_callback() { 116 98 117 printf( 99 118 '<input type="text" id="bcc" name="in_mc_option_bcc[bcc]" value="%s" /> … … 102 121 __( 'Set one e-mail address like "demo@example.com" currently multiple e-mail addresses are not supported.', 'in_mc' ) 103 122 ); 123 124 104 125 } 105 126 127 /** 128 * Get the settings option array and print one of its values 129 */ 130 public function bcc_use_callback() { 131 printf( 132 '<input type="hidden" id="bcc_use" name="in_mc_option_bcc[bcc_use]" value="0" ' . ( ( isset( $this->options['bcc_use'] ) && $this->options['bcc_use'] == 0 ) ? 'checked' : '' ) . '/> 133 <input type="checkbox" id="bcc_use" name="in_mc_option_bcc[bcc_use]" value="1" ' . ( ( isset( $this->options['bcc_use'] ) && $this->options['bcc_use'] == 1 ) ? 'checked' : '' ) . '/> 134 <div class="description">%s</div> ', 135 __( 'Default behavior is sending a copy of the mail. If this box is checked we will the email above to the BCC instead.</br> The main 136 benefit is that you can see the original form address.', 'in_mc' ) 137 ); 138 139 140 } 106 141 } -
inesta-send-mail-copy/trunk/src/Inesta/MailCopy/MailHandler.php
r1539742 r1542298 15 15 16 16 $email = $options['bcc']; 17 $isBcc = ( isset( $options['bcc_use'] ) && $options['bcc_use'] == 1 ) ? true : false; 17 18 18 // if the email address is already in the to 19 if ( is_array( $args['to'] ) ) { 20 foreach ( $args['to'] as $to ) { 21 if ( self::check_string_contains_email( $to, $email ) ) { 19 if ( $isBcc ) { 20 $args['headers'][] = 'BCC: ' . $email; 21 22 } else { 23 // if the email address is already in the to 24 if ( is_array( $args['to'] ) ) { 25 foreach ( $args['to'] as $to ) { 26 if ( self::check_string_contains_email( $to, $email ) ) { 27 return $args; 28 } 29 } 30 } else { 31 if ( self::check_string_contains_email( $args['to'], $email ) ) { 22 32 return $args; 23 33 } 24 34 } 25 } else { 26 if ( self::check_string_contains_email( $args['to'], $email ) ) { 27 return $args; 28 } 35 36 wp_mail( $email, $args['subject'], $args['message'], $args['headers'], $args['attachments'] ); 37 29 38 } 30 31 wp_mail( $email, $args['subject'], $args['message'], $args['headers'], $args['attachments'] );32 39 33 40 return $args;
Note: See TracChangeset
for help on using the changeset viewer.