72048172 by Jeff Balicki

mandrill update

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent aef5a431
Showing 35 changed files with 341 additions and 303 deletions
1 ![Send Emails with Mandrill](https://ps.w.org/send-emails-with-mandrill/assets/banner-772x250.jpg)
2
3 # Send Emails with Mandrill
4 This is a fork of the official wpMandrill plugin for Wordpress, since it is no longer being actively supported. We encourage any developers to contribute to making this plugin better as we are actively maintaining this repository for the community's benefit.
5
6 Our plugin can be downloaded for free from the WordPress repository here:
7 https://wordpress.org/plugins/send-emails-with-mandrill/
8
9 Original wpMandrill plugin can be found here:
10 https://wordpress.org/plugins/wpmandrill/
11
12 Please help us gain visibility on this plugin by giving us a five-star rating on the WordPress plugin page here:
13 https://wordpress.org/support/plugin/send-emails-with-mandrill/reviews/#new-post .
14
15 # For developers contributing to this repository
16 For those of you forking this repository, please submit any pull requests to the `develop` branch. `develop` acts as the stable pre-release branch of the plugin. When new versions are released, `develop` will be merged into `master` where the code will then be tagged with the release's version number.
17
18 When submitting fixes to issues or new features/bug fixes, please make sure to branch and submit pull requests for each individually so we can effectively QA each one for accurately.
19
20 Also, thank you! We need developers like you to help us make this a great plugin for the whole WordPress community.
21
22 ---
23
24 ##### Miller Media offers maintenance, design and custom development for WordPress as a service. If you need help with your site, don't hestiate to visit the [Miller Media website](https://www.millermedia.io) or contact us at [support@miller-media.com](mailto:support@miller-media.com)
...@@ -64,5 +64,10 @@ ...@@ -64,5 +64,10 @@
64 max-width: 90% !important; 64 max-width: 90% !important;
65 margin-top:15px; 65 margin-top:15px;
66 } 66 }
67 .stuffbox h3 { cursor: default !important; padding: 3px 3px 3px 10px; } 67 .stuffbox h3, .stuffbox h2 { cursor: default !important; padding: 3px 3px 3px 10px; }
68 .stuffbox div.inside { padding-bottom: 10px;} 68 .stuffbox div.inside { padding-bottom: 10px;}
69
70 .stuffbox table.form-table { margin: 3px 3px 3px 10px; width: auto; }
71 .stuffbox h2 { text-decoration: underline; }
72
73 .stuffbox span.settings_sub_header {padding: 0px 10px; }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -18,8 +18,8 @@ JSON.stringify = JSON.stringify || function (obj) { ...@@ -18,8 +18,8 @@ JSON.stringify = JSON.stringify || function (obj) {
18 } 18 }
19 }; 19 };
20 20
21 jQuery(document).bind( 'ready', function() { 21 jQuery( function() {
22 jQuery('#filter,#display').bind('change keyup', function() { 22 jQuery('#filter,#display').on('change keyup', function() {
23 23
24 if ( jQuery("#filter option:selected").val() == 'none' ) { 24 if ( jQuery("#filter option:selected").val() == 'none' ) {
25 var display = 'block'; 25 var display = 'block';
...@@ -30,7 +30,7 @@ jQuery(document).bind( 'ready', function() { ...@@ -30,7 +30,7 @@ jQuery(document).bind( 'ready', function() {
30 jQuery('#all_time').css('display',display); 30 jQuery('#all_time').css('display',display);
31 showStats(); 31 showStats();
32 }); 32 });
33 jQuery('.columns-prefs, #collapse-button').bind('click', function () { 33 jQuery('.columns-prefs, #collapse-button').on('click', function () {
34 redrawDashboardWidget(); 34 redrawDashboardWidget();
35 }); 35 });
36 36
......
...@@ -259,14 +259,6 @@ msgstr "No tienes suficiente permisología para acceder a esta página." ...@@ -259,14 +259,6 @@ msgstr "No tienes suficiente permisología para acceder a esta página."
259 msgid "Send Test" 259 msgid "Send Test"
260 msgstr "Enviar Prueba" 260 msgstr "Enviar Prueba"
261 261
262 #: wpmandrill.php:313
263 msgid "Latest from Mandrill..."
264 msgstr "Lo último de Mandrill..."
265
266 #: wpmandrill.php:327
267 msgid "News from MailChimp..."
268 msgstr "Noticias de MailChimp"
269
270 #: wpmandrill.php:356 262 #: wpmandrill.php:356
271 msgid "Mandrill How-Tos" 263 msgid "Mandrill How-Tos"
272 msgstr "Mandrill: ¿Cómo hago?" 264 msgstr "Mandrill: ¿Cómo hago?"
......
...@@ -255,14 +255,6 @@ msgstr "" ...@@ -255,14 +255,6 @@ msgstr ""
255 msgid "Send Email" 255 msgid "Send Email"
256 msgstr "" 256 msgstr ""
257 257
258 #: wpmandrill.php:295
259 msgid "Latest from Mandrill..."
260 msgstr ""
261
262 #: wpmandrill.php:309
263 msgid "News from MailChimp..."
264 msgstr ""
265
266 #: wpmandrill.php:336 258 #: wpmandrill.php:336
267 msgid "Mandrill How-Tos" 259 msgid "Mandrill How-Tos"
268 msgstr "" 260 msgstr ""
......
...@@ -96,8 +96,17 @@ class Mandrill { ...@@ -96,8 +96,17 @@ class Mandrill {
96 if( 200 == $response_code ) { 96 if( 200 == $response_code ) {
97 return $body; 97 return $body;
98 } else { 98 } else {
99 error_log("wpMandrill Error: Error {$body['code']}: {$body['message']}"); 99 if( !is_array( $body ) ) {
100 throw new Mandrill_Exception( "wpMandrill Error: {$body['code']}: {$body['message']}", $response_code); 100 $code = 'Unknown';
101 $message = 'Unknown';
102 } else {
103 $code = 'Unknown' ? !array_key_exists('code', $body) : $body['code'];
104 $message = 'Unknown' ? !array_key_exists('message', $body) : $body['message'];
105 }
106
107 error_log("wpMandrill Error: Error {$code}: {$message}");
108 throw new Mandrill_Exception("wpMandrill Error: {$code}: {$message}", $response_code);
109
101 } 110 }
102 } 111 }
103 112
...@@ -292,36 +301,6 @@ class Mandrill { ...@@ -292,36 +301,6 @@ class Mandrill {
292 } 301 }
293 302
294 /** 303 /**
295 * @link https://mandrillapp.com/api/docs/urls.html#method=list
296 *
297 * @return array|Mandrill_Exception
298 */
299 function urls_list() {
300
301 return $this->request('urls/list');
302 }
303
304 /**
305 * @link https://mandrillapp.com/api/docs/urls.html#method=time-series
306 *
307 * @return array|Mandrill_Exception
308 */
309 function urls_time_series($name) {
310
311 return $this->request('urls/time-series', array('name' => $name) );
312 }
313
314 /**
315 * @link https://mandrillapp.com/api/docs/urls.html#method=search
316 *
317 * @return array|Mandrill_Exception
318 */
319 function urls_search($q) {
320
321 return $this->request('urls/search', array('q' => $q) );
322 }
323
324 /**
325 * @link https://mandrillapp.com/api/docs/webhooks.html#method=add 304 * @link https://mandrillapp.com/api/docs/webhooks.html#method=add
326 * 305 *
327 * @return array|Mandrill_Exception 306 * @return array|Mandrill_Exception
...@@ -427,11 +406,9 @@ class Mandrill { ...@@ -427,11 +406,9 @@ class Mandrill {
427 $useragent = wpMandrill::getUserAgent(); 406 $useragent = wpMandrill::getUserAgent();
428 407
429 if( function_exists('curl_init') && function_exists('curl_exec') ) { 408 if( function_exists('curl_init') && function_exists('curl_exec') ) {
430 409
431 if( !ini_get('safe_mode') ){ 410 set_time_limit(2 * 60);
432 set_time_limit(2 * 60); 411
433 }
434
435 $ch = curl_init(); 412 $ch = curl_init();
436 curl_setopt($ch, CURLOPT_URL, $url); 413 curl_setopt($ch, CURLOPT_URL, $url);
437 414
...@@ -507,8 +484,7 @@ class Mandrill { ...@@ -507,8 +484,7 @@ class Mandrill {
507 ob_end_clean(); 484 ob_end_clean();
508 485
509 list($headers, $response) = explode("\r\n\r\n", $response, 2); 486 list($headers, $response) = explode("\r\n\r\n", $response, 2);
510 487
511 if(ini_get("magic_quotes_runtime")) $response = stripslashes($response);
512 $info = array('http_code' => 200); 488 $info = array('http_code' => 200);
513 } else { 489 } else {
514 ob_end_clean(); 490 ob_end_clean();
...@@ -539,17 +515,16 @@ class Mandrill { ...@@ -539,17 +515,16 @@ class Mandrill {
539 if ( !function_exists('set_magic_quotes') ) { 515 if ( !function_exists('set_magic_quotes') ) {
540 function set_magic_quotes($value) { return true;} 516 function set_magic_quotes($value) { return true;}
541 } 517 }
542 518 if ( !function_exists('get_magic_quotes_runtime') ) {
543 // if (strnatcmp(phpversion(),'6') >= 0) { 519 function get_magic_quotes_runtime() { return false; }
544 // $magic_quotes = get_magic_quotes_runtime(); 520 }
545 // set_magic_quotes_runtime(0); 521 if ( !function_exists('set_magic_quotes_runtime') ) {
546 // } 522 function set_magic_quotes_runtime($value) { return true; }
523 }
547 524
548 $file_buffer = file_get_contents($path); 525 $file_buffer = file_get_contents($path);
549 $file_buffer = chunk_split(base64_encode($file_buffer), 76, "\n"); 526 $file_buffer = chunk_split(base64_encode($file_buffer), 76, "\n");
550 527
551 // if (strnatcmp(phpversion(),'6') >= 0) set_magic_quotes_runtime($magic_quotes);
552
553 $mime_type = ''; 528 $mime_type = '';
554 if ( function_exists('finfo_open') && function_exists('finfo_file') ) { 529 if ( function_exists('finfo_open') && function_exists('finfo_file') ) {
555 $finfo = finfo_open(FILEINFO_MIME_TYPE); 530 $finfo = finfo_open(FILEINFO_MIME_TYPE);
......
1 <?php
2
3 class pluginActivation
4 {
5 function __construct()
6 {
7 add_action('admin_init', array($this, 'check_version'));
8
9 if (!self::compatible_version()) {
10 return;
11 }
12 }
13
14 static function activation_check()
15 {
16 if (!self::compatible_version()) {
17 deactivate_plugins(SEWM_BASE);
18 wp_die(__('Send Emails with Mandrill requires PHP 5.6 or higher. Please upgrade your version of PHP to activate.', 'send-emails-with-mandrill'));
19 }
20 }
21
22 function check_version()
23 {
24 if (!self::compatible_version()) {
25 if (is_plugin_active(SEWM_BASE)) {
26 deactivate_plugins(SEWM_BASE);
27 add_action('admin_notices', array($this, 'disabled_notice'));
28
29 if (isset($_GET['activate'])) {
30 unset($_GET['activate']);
31 }
32 }
33 }
34 }
35
36 function disabled_notice()
37 {
38 echo '<div class="notice notice-error is-dismissible"><p>' . esc_html__('Send Emails with Mandrill requires PHP 5.6 or higher. Please upgrade your version of PHP to activate.', 'send-emails-with-mandrill') . '</p></div>';
39 }
40
41 static function compatible_version()
42 {
43 if (version_compare(PHP_VERSION, '5.6', '<'))
44 return false;
45
46 // Add sanity checks for other version requirements here
47 return true;
48 }
49 }
50
51 global $pluginCheck;
52 $pluginCheck = new pluginActivation();
53
54 register_activation_hook(__FILE__, array('pluginActivation', 'activation_check'));
...\ No newline at end of file ...\ No newline at end of file
1 === Send Emails with Mandrill ===
2 Contributors: MillerMediaNow, mikemm01, MC_Will, MC_Amanda, cornelraiu-1, crstauf, bizmatebiz, andrewhilson, anthonywnz, srumery, ronald2020, ilanio, sanderteirlynck
3 Tags: mandrill, mailchimp, transactional email, email, email reliability, smtp, wp_mail, email templates
4 Requires PHP: 5.6
5 Requires at least: 3.0
6 Tested up to: 6.1.1
7 Stable tag: 1.3.1
8 License: GPLv2
9
10 The Send Emails with Mandrill plugin sends emails that are generated by WordPress through Mandrill, a transactional email service powered by MailChimp.
11
12 == Description ==
13
14 **Did you find this plugin helpful?** Please consider [leaving a 5-star review](https://wordpress.org/support/view/plugin-reviews/send-emails-with-mandrill/).
15
16 Note: This is a forked version of the now unsupported <a href="https://wordpress.org/plugins/wpmandrill/">wpMandrill</a> plugin. The notes below are copied over from the original plugin and will be updated as relevant updates become available. Please help by contributing to the GitHub repository [Send Emails With Mandrill on GitHub](https://github.com/Miller-Media/send-emails-with-mandrill)
17
18 This plugin uses [Mandrill API](http://mandrillapp.com/api/docs/) to send outgoing emails, with or without attachments, from your Wordpress installation. It replaces the wp_mail function included with WordPress.
19
20 Emails are tracked and automatically tagged for statistics within the Mandrill Dashboard. You can also add general tags to every email sent, as well as particular tags based on selected emails defined by your requirements.
21
22 You can also use your own templates that have been added to your MailChimp account and shared with your Mandrill account.
23
24 There are a few levels of integrations between your WordPress installation and this plugin:
25
26 1. The simplest option: Install it, configure it, and Send Emails with Mandrill will start sending your emails through Mandrill.
27 1. If you need to fine tune certain emails, you can change any email by creating a filter for the **mandrill_payload** hook.
28 1. For further customization, we've exposed a function that allows you to send emails from within your plugins, instead of the regular wp_mail function: **wpMandrill::mail**
29
30 Enable the connection by entering a valid API key in the settings page or adding the line `define('SEWM_API_KEY', '{YOUR_API_KEY}')` your site's wp-config.php file.
31
32 Spanish translation available.
33
34 == Installation ==
35
36 1. Upload `Send Emails with Mandrill` to the `/wp-content/plugins/` directory
37 1. Activate the plugin through the _Plugins_ menu in WordPress
38 1. Configure plugin in _Settings > Mandrill_
39
40 == Frequently Asked Questions ==
41
42 = Why do I need a Mandrill API key? =
43
44 In order to use this plugin, you have to provide one of your Mandrill API keys. That's currently the only way we can get access to your Mandrill account.
45
46 = Do I need a MailChimp account? =
47
48 Yes. If you aren't currently on a MailChimp Monthly Plan, you'll first need to upgrade or switch to a Monthly Plan. Once you have upgraded you can follow the steps [here](https://mailchimp.com/help/add-or-remove-mandrill/) to add Mandrill to your account.
49
50 = Are all emails routed through Mandrill? =
51
52 Yes. We try to send every single email sent through your WordPress installation. We also try to process your headers and attachments.
53
54 If the sending fails for any reason, the plugin will try to send it again using the WordPress wp_mail function.
55
56 = What if I need to send some of my emails using the native wp_mail() function?
57
58 Use the mandrill_payload filter and add a new parameter called 'force_native' to the $message variable, and set it to true:
59
60 $message['force_native'] = true;
61
62 = My emails are broken and show weird CSS code =
63
64 In version 1.09, we added a setting that allows you to tell the plugin if you want to replace your line feeds by <br/>. Try playing with that switch.
65
66 If it works for certain emails but doesn't work for others, you might want to modify this setting using the **mandrill_nl2br** filter. For example, if you don't want to use this filter for the "forgot password" emails, add something like this to your theme's functions.php file:
67
68 function my_function($nl2br, $message) {
69 if ( in_array('wp_retrieve_password', $message['tags']['automatic']) ) {
70 $nl2br = false;
71 }
72 return $nl2br;
73 }
74 add_filter('mandrill_nl2br', 'my_function');
75
76
77 = Is there any way to check what's going on? =
78
79 If we couldn't send your email through Mandrill, we'll try to leave the Mandrill response in your server's log so that's your first stop.
80
81 Additionally, if you set the WP_DEBUG constant (defined in your wp-config.php file) to true, you'll see some messages added by the plugin in key parts of the process.
82
83 = I am getting an Invalid API Key message and I'm sure my API is valid!
84
85 Please verify the following:
86
87 1. That your API key is active (this can be viewed on the SMTP & API Credentials page in your Mandrill account);
88 2. That your web server has either cURL installed or is able to use fsock*() functions (if you don't know what this means, you may want to check with your hosting provider for more details);
89 3. That the domain name you're using above is listed in the Sending Domains for your Mandrill account.
90
91 == Request ==
92
93 If you find that a part of this plugin isn't working, please don't simply click the Wordpress "It's broken" button. Let us know what's broken in [its support forum](https://wordpress.org/support/plugin/send-emails-with-mandrill/) so we can make it better. Our [mind-reading device](http://www.youtube.com/watch?v=cCTlonSwePs) still needs some tweaking.
94
95 == Localizations ==
96 Send Emails with Mandrill is currently localized in the following languages:
97
98 * Spanish (es_ES)
99
100 == Known Issues ==
101
102 * Daily statistics will show data for the first 20 senders (emails) registered.
103 * Daily statistics will show data for the first 40 tags registered.
104
105 If your account has more than 20 senders registered or more than 40 tags used, the detailed daily statisticas might show incompleted data.
106
107 == Screenshots ==
108
109 1. Settings screen
110 2. Statistics
111 3. Dashboard widget
112 4. Dashboard widget Settings
113
114 == Changelog ==
115 = 1.3.1 =
116 * Check for error messages parameters before processing (was throwing an error)
117
118 = 1.3 =
119 * Added setting to turn off Dashboard Widget
120 * Added ability to manually fetch new data from Reports screen
121 * Added ability to define API key as SEWM_API_KEY in wp-config.php file
122 * Minor error handling adjustments
123
124 = 1.2.13 =
125 * Setting to disable <br /> setting for WooCommerce emails due to layout issues from recent WooCommerce updates
126
127 = 1.2.12 =
128 * Updates to deprecated jQuery functions
129
130 = 1.2.9 =
131 * Removed deprecated contextual_help() function and added add_help_tab()
132
133 = 1.2.8 =
134 * Add wpmandrill_enable_reports and wpmandrill_enable_widgets filters to programmatically disable the reports dashboard and widget if desired.
135
136 = 1.2.7 =
137 * Removed code added for previous Mandrill outage
138
139 = 1.2.6 =
140 * Updated messaging on how to handle the upcoming Mandrill outage
141 * Bug fix for memcache overload when loading Mandrill reports page on high traffic sites
142
143 = 1.2.5 =
144 * Updated plugin screenshots for WordPress repository
145 * Added support/setting for Mandrill subaccount
146 * Removed discontinued Mandrill API endpoint support (URL tracking)
147
148 = 1.2.4 =
149 * Removed RSS Feeds due to WordPress core bugs (SimplePie library)
150 * CSS adjustments
151 * Fixed false negatives when used in conjunction with Contact Form 7 and other mail sending programs
152
153 = 1.2.3 =
154 * Fixed WooCommerce checkout issue (class scope bug)
155
156 = 1.2.2 =
157 * More detailed error logging for failed e-mails
158 * Added email formatting to include 'name'
159
160 = 1.2.1 =
161 * PHP warning fix
162
163 = 1.2 =
164 * Added ability to override wp_mail_native function with a WordPress action
165 * 404 console fixes
166 * Various undefined variable fixes
167
168 = 1.1 =
169 * Added support for PHP 7.2
170 * Removed support for PHP < 5.6
171 * Added plugin activation compatibility checks
172
173 = 1.0 =
174 * Initial release
175
...@@ -36,7 +36,13 @@ $lit['clickrate'] = __('Click Rate','wpmandrill'); ...@@ -36,7 +36,13 @@ $lit['clickrate'] = __('Click Rate','wpmandrill');
36 ?> 36 ?>
37 <div id="alltime_report"> 37 <div id="alltime_report">
38 <h3><?php echo sprintf(__('All-time statistics since %s: ', 'wpmandrill'),date('m/d/Y',strtotime($stats['general']['created_at']))); ?></h3> 38 <h3><?php echo sprintf(__('All-time statistics since %s: ', 'wpmandrill'),date('m/d/Y',strtotime($stats['general']['created_at']))); ?></h3>
39 39 <hr />
40 <form action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" method="POST">
41 <input name="action" value="sewm_fetch_new" type="hidden" />
42 <?php submit_button('Fetch new data'); ?>
43 <h5 style="margin-top:0px;">Note: Fetching new data can take a long time</h5>
44 </form>
45 <hr />
40 <div id="alltime_report_canvas"> 46 <div id="alltime_report_canvas">
41 <div class="stat_box"><?php _e('Reputation:', 'wpmandrill'); ?><br/><span><?php echo $stats['general']['reputation']?>%</span></div> 47 <div class="stat_box"><?php _e('Reputation:', 'wpmandrill'); ?><br/><span><?php echo $stats['general']['reputation']?>%</span></div>
42 <div class="stat_box"><?php _e('Quota:', 'wpmandrill'); ?><br/><span><?php echo $stats['general']['hourly_quota']?> <?php _e('sends/hour', 'wpmandrill'); ?></span></div> 48 <div class="stat_box"><?php _e('Quota:', 'wpmandrill'); ?><br/><span><?php echo $stats['general']['hourly_quota']?> <?php _e('sends/hour', 'wpmandrill'); ?></span></div>
...@@ -152,7 +158,7 @@ var dclickrates = [<?php echo implode(',',$dcrate);?>] ...@@ -152,7 +158,7 @@ var dclickrates = [<?php echo implode(',',$dcrate);?>]
152 var dticks = [<?php echo implode(',',array_keys($stats['graph']['daily']['delivered']));?>] 158 var dticks = [<?php echo implode(',',array_keys($stats['graph']['daily']['delivered']));?>]
153 jQuery(function () { 159 jQuery(function () {
154 var previousPoint = null; 160 var previousPoint = null;
155 jQuery("#hourly_report_canvas").bind("plothover", function (event, pos, item) { 161 jQuery("#hourly_report_canvas").on("plothover", function (event, pos, item) {
156 if (item) { 162 if (item) {
157 if (previousPoint != item.dataIndex) { 163 if (previousPoint != item.dataIndex) {
158 previousPoint = item.dataIndex; 164 previousPoint = item.dataIndex;
...@@ -174,7 +180,7 @@ jQuery(function () { ...@@ -174,7 +180,7 @@ jQuery(function () {
174 previousPoint = null; 180 previousPoint = null;
175 } 181 }
176 }); 182 });
177 jQuery("#daily_report_canvas").bind("plothover", function (event, pos, item) { 183 jQuery("#daily_report_canvas").on("plothover", function (event, pos, item) {
178 if (item) { 184 if (item) {
179 if (previousPoint != item.dataIndex) { 185 if (previousPoint != item.dataIndex) {
180 previousPoint = item.dataIndex; 186 previousPoint = item.dataIndex;
......
1 <?php
2 /*
3 Plugin Name: Send E-mails with Mandrill
4 Description: Send e-mails using Mandrill. This is a forked version of the now unsupported plugin <a href="https://wordpress.org/plugins/wpmandrill/">wpMandrill</a>.
5 Author: Miller Media ( Matt Miller )
6 Author URI: http://www.millermedia.io
7 Version: 1.3.1
8 Requires PHP: 5.6
9 Text Domain: send-emails-with-mandrill
10 */
11
12 /* Copyright 2012 MailChimp (email : will@mailchimp.com )
13 Copyright 2018 Miller Media (email : support@miller-media.com )
14
15 This program is free software; you can redistribute it and/or modify
16 it under the terms of the GNU General Public License as published by
17 the Free Software Foundation using version 2 of the License.
18
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
28
29 */
30
31 if ( ! defined( 'ABSPATH' ) ) exit;
32
33 // Define plugin constants
34 if ( !defined('SEWM_VERSION'))
35 define( 'SEWM_VERSION', '1.3.1' );
36
37 if ( !defined( 'SEWM_BASE' ) )
38 define( 'SEWM_BASE', plugin_basename( __FILE__ ) );
39
40 if ( !defined( 'SEWM_URL' ) )
41 define( 'SEWM_URL', plugin_dir_url( __FILE__ ) );
42
43 if ( !defined( 'SEWM_PATH' ) )
44 define( 'SEWM_PATH', plugin_dir_path( __FILE__ ) );
45
46 include( plugin_dir_path( __FILE__ ) . 'lib/pluginActivation.class.php');
47 include( plugin_dir_path( __FILE__ ) . 'lib/wpMandrill.class.php');
48
49 wpMandrill::on_load();
1 === wpMandrill ===
2 Contributors: MC_Will
3 Tags: mandrill, mailchimp, transactional email, email, email reliability, smtp, wp_mail, email templates
4 Requires at least: 3.0
5 Tested up to: 3.8
6 Stable tag: trunk
7 License: GPLv2
8
9 The wpMandrill plugin sends emails that are generated by WordPress through Mandrill, a transactional email service powered by MailChimp.
10
11 == Description ==
12
13 This plugin uses [Mandrill API](http://mandrillapp.com/api/docs/) to send outgoing emails, with or without attachments, from your Wordpress installation. It replaces the wp_mail function included with WordPress.
14
15 Emails are tracked and automatically tagged for statistics within the Mandrill Dashboard. You can also add general tags to every email sent, as well as particular tags based on selected emails defined by your requirements.
16
17 You can also use your own templates that have been added to your MailChimp account and shared with your Mandrill account.
18
19 There are a few levels of integrations between your WordPress installation and this plugin:
20
21 1. The simplest option: Install it, configure it, and wpMandrill will start sending your emails through Mandrill.
22 1. If you need to fine tune certain emails, you can change any email by creating a filter for the **mandrill_payload** hook.
23 1. For further customization, we've exposed a function that allows you to send emails from within your plugins, instead of the regular wp_mail function: **wpMandrill::mail**
24
25 This plugin is currently released as **beta** for early adopter evaluation and finalizing of the initial feature set.
26
27 Spanish translation available.
28
29 == Installation ==
30
31 1. Upload `wpMandrill` to the `/wp-content/plugins/` directory
32 1. Activate the plugin through the _Plugins_ menu in WordPress
33 1. Configure plugin in _Settings > Mandrill_
34
35 == Frequently Asked Questions ==
36
37 = Why do I need a Mandrill API key? =
38
39 In order to use this plugin, you have to provide one of your Mandrill API keys. That's currently the only way we can get access to your Mandrill account.
40
41 = Do I need a MailChimp account? =
42
43 Nop.
44
45 = Are all emails routed through Mandrill? =
46
47 Yes. We try to send every single email sent through your WordPress installation. We also try to process your headers and attachments.
48
49 If the sending fails for any reason, the plugin will try to send it again using the WordPress wp_mail function.
50
51 = What if I need to send some of my emails using the native wp_mail() function?
52
53 Use the mandrill_payload filter and add a new parameter called 'force_native' to the $message variable, and set it to true:
54
55 $message['force_native'] = true;
56
57 = My emails are broken and show weird CSS code =
58
59 In version 1.09, we added a setting that allows you to tell the plugin if you want to replace your line feeds by <br/>. Try playing with that switch.
60
61 If it works for certain emails but doesn't work for others, you might want to modify this setting using the **mandrill_nl2br** filter. For example, if you don't want to use this filter for the "forgot password" emails, add something like this to your theme's functions.php file:
62
63 function my_function($nl2br, $message) {
64 if ( in_array('wp_retrieve_password', $message['tags']['automatic']) ) {
65 $nl2br = false;
66 }
67 return $nl2br;
68 }
69 add_filter('mandrill_nl2br', 'my_function');
70
71
72 = Is there any way to check what's going on? =
73
74 If we couldn't send your email through Mandrill, we'll try to leave the Mandrill response in your server's log so that's your first stop.
75
76 Additionaly, if you set the WP_DEBUG constant (defined in your wp-config.php file) to true, you'll see some messages added by the plugin in key parts of the process.
77
78 = I am getting an Invalid API Key message and I'm sure my API is valid!
79
80 Please verify the following:
81
82 1. That your API key is active (this can be viewed on the SMTP & API Credentials page in your Mandrill account);
83 1. That your web server has either cURL installed or is able to use fsock*() functions (if you don't know what this means, you may want to check with your hosting provider for more details);
84 1. That the domain name you're using above is listed in the Sending Domains for your Mandrill account.
85
86 == Request ==
87
88 If you find that a part of this plugin isn't working, please don't simply click the Wordpress "It's broken" button. Let us know what's broken in [its support forum](http://wordpress.org/tags/wpmandrill?forum_id=10) so we can make it better. Our [mind-reading device](http://www.youtube.com/watch?v=cCTlonSwePs) still needs some tweaking.
89
90 == Localizations ==
91 wpMandrill is currently localized in the following languages:
92
93 * Spanish (es_ES)
94
95 == Known Issues ==
96
97 * Daily statistics will show data for the first 20 senders (emails) registered.
98 * Daily statistics will show data for the first 40 tags registered.
99
100 If your account has more than 20 senders registered or more than 40 tags used, the detailed daily statisticas might show incompleted data.
101
102 == Screenshots ==
103
104 1. Settings screen
105 2. Statistics
106 3. Dashboard widget
107 4. Dashboard widget Settings
108
109 == Changelog ==
110 = 1.33 =
111 * ADDED: Logging messages to trace a bug where the stats are not getting updated
112 * FIXED: Order of preference for tags.
113 * ADDED: Support for css inlining, recipient preservation, whether or not to have the view content link in your Mandrill dashboard, tracking, signing, and return-path domains, using subaccounts, per recipient metadata, pool of ips, email scheduling, and asynchronous sending in wpMandrill::mail().
114 * REMOVED: The concept of 'verified domains' was completely removed from the plugin.
115 * ADDED: Tracking options in the settings page
116 * ADDED: New filter, mandrill_nl2br, that can be used to modify the value of the "Replace Line Feeds by <br>" setting, for specific messages. Check the How-To to see how it works.
117 * FIXED: Removing wrongly formatted attachments from the payload
118
119 = 1.32 =
120 * FIXED: Reordering constructors of Mandrill class to prevent the "Redefining already defined constructor" message
121 * UPDATE: Favoring self:: instead of wpMandrill::
122
123 = 1.31 =
124 * FIXED: Some PHP 5.3 installations don't have the finfo_open available so we're now checking for the function instead of the PHP version
125
126 = 1.30 =
127 * FIXED: Multiples To: recipients where not being handling correctly.
128
129 = 1.29 =
130 * ADDED: wp_mail, wp_mail_from, and wp_mail_from_name filters. ** Thanks Mike Little! **
131 * ADDED: Support for "important" emails.
132 * UPDATED: Wordpress wp_mail function code.
133 * ADDED: wpMandrill User-Agent
134
135 = 1.28 =
136 * ADDED: If you want to fall back some of your emails to the native wp_mail function, now you can do it by using the mandrill_payload filter and setting a parameter called 'force_native' to true.
137 * REMOVED: Mime type checking on attachments.
138 * ADDED: Sending MIME TYPE of attachments to Mandrill only when wpMandrill is able to find it.
139
140 = 1.27 =
141 * FIXED: Removing php short tags. ** Thanks Kailey Lampert! **
142
143 = 1.26 =
144 * UPDATED: Now Mandrill accepts any content type and so does wpMandrill.
145 * FIXED: Queued messages were triggering the native wp_mail function. ** Thanks Scott Connerly! **
146
147 = 1.25 =
148 * FIXED: Undefined WPDOMAIN constant in stats.php
149
150 = 1.24 =
151 * UPDATED: Dashboard widget shown only to those capable of manage_options
152 * ADDED: CURL calls doesn't verify SSL certificates anymore. ** Thanks Bruno Braga! **
153 * ADDED: Adding support for editable regions. ** Thanks dennissmolek **
154 * FIXED: Using a literal as the textdomain instead of a constant. ** Thanks Joost! **
155 * FIXED: Cleaning some unused variables. ** Thanks Joost! **
156 * FIXED: Removed checking of sender domain at send time.
157
158 = 1.23 =
159 * FIXED: JS Alerts in wrong places...
160
161 = 1.22 =
162 * UPDATED: Replacing Highcharts in favor of Flot
163 * ADD: Cron job to fetch stats
164
165 = 1.21 =
166 * FIXED: Logging wrong error messages when sending emails with no attachments
167 * FIXED: Attachments that Mandrill doesn't support were discarded instead of sending the email (with attachment) through the native wp_mail function.
168 * ADDED: Added support Audio and Video file attachments.
169 * FIXED: Valid Domains matching is NOT case-sensitive now.
170 * FIXED: Better error reporting on Dashboard widgets.
171 * FIXED: Validating FROM: email address after mandrill_payload has been processed.
172
173 = 1.20 =
174 * ADDED: Mandrill's Privacy Policy and Terms of Use
175 * FIXED: Sending more than one attachment was failing
176 * FIXED: Doing a Ping call only when displaying the API Key on the settings page
177 * ADDED: Support for Global Merge Vars, Per-Recipient Merge Vars, Google Analytics, and Meta Data in wpMandrill::mail()
178 * FIXED: Logging error messages even if WP_DEBUG is false.
179
180 = 1.12 =
181 * FIXED: Issue with the CSS declaration of the RSS icon displayed on the settings page. ** Thanks Nicholas Ciske! **
182 * FIXED: Highcharts' Exporting module not loaded for dashboard widget
183 * FIXED: Removing unnecessary pings to MandrillApp.com and instanciating the API client on demand ** Thanks Per Wiklander! **
184
185 = 1.11 =
186 * ADDED: screenshot-4.jpg
187 * FIXED: Emails delivered % in Mandrill stats
188 * ADDED: Limiting the numbers of senders that the Mandrill stats reports.
189 * FIXED: Limiting the numbers of days to 30 in Daily Sending Volume graph in Mandrill stats reports.
190 * ADDED: Visual notification in the dashboard widget while loading.
191 * ADDED: Support for sockets when CURL is not present.
192
193 = 1.10 =
194 * ADDED: Blank .po file for other translations :)
195 * ADDED: Some debugging messages just in case need arises.
196 * ADDED: Adding GNU license
197 * ADDED: Mandrill's blog RSS
198
199 = 1.09 =
200 * ADDED: Reply-To Setting
201 * ADDED: Replacing line feed by <br> setting.
202
203 = 1.08 =
204 * FIXED: Wrong references to self:: in wp_mail introduce in 1.04 :(
205
206 = 1.07 =
207 * FIXED: Removing notices in the dashboard widget when there's no open or click data in the last 7 days.
208 * FIXED: No having general tags defined were causing a validation error. ** Thanks Max Rice! **
209 * FIXED: Daily stats showing some hourly stats.
210 * UPDATED: Spanish translation updated.
211 * FIXED: Speeding dashboard widget results.
212
213 = 1.06 =
214 * FIXED: Some installations were reporting valid API keys as invalid due to a restrictive server configuration regarding Time-Out.
215
216 = 1.05 =
217 * FIXED: Contextual help tab getting open in all admin pages when plugin was not configured correctly.
218 * FIXED: Some references to verified domains. All domains are now verified in Mandrill.
219 * FIXED: Mandrill Class was returning Exceptions in two places (not throwing them).
220
221 = 1.03 =
222 * FIXED: Test email were using an old function.
223 * FIXED: Some data type checking to avoid PHP warnings.
224
225 = 1.02 =
226 * FIXED: Dashboard widget title was displaying incorrectly when a filter was defined.
227
228 = 1.01 =
229 * REMOVED: How-To Plugin
230 * ADDED: How-To page
231
232 = 1.0 =
233 * Public release
234