Plugin Directory

Changeset 1542298


Ignore:
Timestamp:
11/28/2016 09:44:45 PM (9 years ago)
Author:
roelv
Message:

Created v1.0.1

Location:
inesta-send-mail-copy/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • inesta-send-mail-copy/trunk/in_wpmail_copy.php

    r1539742 r1542298  
    33 * Plugin Name:     Inesta Send Mail Copy
    44 * Plugin URI:      https://inesta.nl
    5  * Description:     Sends a copy of 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.
    66 * Author:          Inesta
    77 * Author URI:      https://inesta.nl
    88 * Text Domain:     in_mc
    99 * Domain Path:     /languages
    10  * Version:         0.1.0
     10 * Version:         1.0.1
    1111 *
    1212 * @package         In_wpmail_copy
  • inesta-send-mail-copy/trunk/readme.txt

    r1540487 r1542298  
    1 === === Inesta Send Mail Copy ===
     1=== Inesta Send Mail Copy ===
    22Contributors: roelv
    33Donate link: https://inesta.nl
     
    55Requires at least: 3.7
    66Tested up to: 4.7-alpha-38178-src
    7 Stable tag: 1.0
     7Stable tag: 1.0.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3030== Frequently Asked Questions ==
    3131
    32 = A question that someone might have =
     32= How do I see the original to address =
    3333
    34 An answer to that question.
     34You should use the BCC option. Then the original sender is shown in the TO field.
    3535
    36 = What about foo bar? =
    37 
    38 Answer to foo bar dilemma.
    3936
    4037== Screenshots ==
    4138
    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 ==
    4740
    48 == Changelog ==
     41= 1.0.1 =
     42* Shows the original input again.
     43* Addes support to send BCC
    4944
    5045= 1.0 =
    5146* 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  
    2626        );
    2727
     28        register_setting(
     29            'in_mc_option_group', // Option group
     30            'in_mc_option_bcc', // Option name
     31            [ $this, 'sanitize' ] // Sanitize
     32        );
     33
    2834        add_settings_section(
    2935            'setting_section_id', // ID
     
    4147        );
    4248
     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
    4357    }
    4458
     
    4963    public function create_admin_page() {
    5064        // Set class property
    51         $this->options = get_option( 'in_mc_options' );
     65        $this->options = get_option( 'in_mc_option_bcc' );
    5266
    5367        ?>
     
    7791    ) {
    7892
     93        $new_input = array();
    7994        if ( isset( $input['bcc'] ) ) {
    8095            $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'] );
    8199        }
    82100
     
    96114     */
    97115    public function bcc_callback() {
     116
    98117        printf(
    99118            '<input type="text" id="bcc" name="in_mc_option_bcc[bcc]" value="%s" />
     
    102121            __( 'Set one e-mail address like "demo@example.com" currently multiple e-mail addresses are not supported.', 'in_mc' )
    103122        );
     123
     124
    104125    }
    105126
     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    }
    106141}
  • inesta-send-mail-copy/trunk/src/Inesta/MailCopy/MailHandler.php

    r1539742 r1542298  
    1515
    1616        $email = $options['bcc'];
     17        $isBcc = ( isset( $options['bcc_use'] ) && $options['bcc_use'] == 1 ) ? true : false;
    1718
    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 ) ) {
    2232                    return $args;
    2333                }
    2434            }
    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
    2938        }
    30 
    31         wp_mail( $email, $args['subject'], $args['message'], $args['headers'], $args['attachments'] );
    3239
    3340        return $args;
Note: See TracChangeset for help on using the changeset viewer.