summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2018-04-18 20:06:44 +0000
committeryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2018-04-18 20:06:44 +0000
commit0bf9ab11082db7ee8feb2a2dc56829c4caf72913 (patch)
treee0e2f4d9859866998dde7fc88874568bbadda07e
parentcfabde5bc30b3a23afad0e0c680658f5edff9236 (diff)
downloadPost-SMTP-0bf9ab11082db7ee8feb2a2dc56829c4caf72913.zip
* remove mailgun docs
* fix js error ($) * fix mail function param * script for dismiss "not configured.." message git-svn-id: https://plugins.svn.wordpress.org/post-smtp/trunk@1860742 b8457f37-d9ea-0310-8a92-e5e31aec5664
-rw-r--r--Postman/Postman-Configuration/postman_manual_config.js2
-rw-r--r--Postman/Postman-Mail/PostmanTransportRegistry.php15
-rw-r--r--Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/attachments.md47
-rw-r--r--Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/index.md330
-rw-r--r--Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/pagination.md17
-rw-r--r--Postman/Postman.php12
-rw-r--r--Postman/PostmanViewController.php26
-rw-r--r--Postman/notifications/PostmanMailNotify.php2
-rw-r--r--postman-smtp.php31
-rw-r--r--readme.txt7
-rw-r--r--script/postman.js13
11 files changed, 96 insertions, 406 deletions
diff --git a/Postman/Postman-Configuration/postman_manual_config.js b/Postman/Postman-Configuration/postman_manual_config.js
index e7668b7..293df28 100644
--- a/Postman/Postman-Configuration/postman_manual_config.js
+++ b/Postman/Postman-Configuration/postman_manual_config.js
@@ -1,7 +1,7 @@
var transports = [];
jQuery(document).ready(
- function() {
+ function($) {
// display password on entry
enablePasswordDisplayOnEntry('input_basic_auth_password',
diff --git a/Postman/Postman-Mail/PostmanTransportRegistry.php b/Postman/Postman-Mail/PostmanTransportRegistry.php
index 77654eb..e86f1f4 100644
--- a/Postman/Postman-Mail/PostmanTransportRegistry.php
+++ b/Postman/Postman-Mail/PostmanTransportRegistry.php
@@ -229,12 +229,21 @@ class PostmanTransportRegistry {
public function getReadyMessage() {
if ( $this->getCurrentTransport()->isConfiguredAndReady() ) {
if ( PostmanOptions::getInstance()->getRunMode() != PostmanOptions::RUN_MODE_PRODUCTION ) {
- return __( 'Postman is in <em>non-Production</em> mode and is dumping all emails.', Postman::TEXT_DOMAIN );
+ return array(
+ 'error' => true,
+ 'message' => __( 'Postman is in <em>non-Production</em> mode and is dumping all emails.', Postman::TEXT_DOMAIN ),
+ );
} else {
- return __( 'Postman is configured.', Postman::TEXT_DOMAIN );
+ return array(
+ 'error' => false,
+ 'message' => __( 'Postman is configured.', Postman::TEXT_DOMAIN ),
+ );
}
} else {
- return __( 'Postman is <em>not</em> configured and is mimicking out-of-the-box WordPress email delivery.', Postman::TEXT_DOMAIN );
+ return array(
+ 'error' => true,
+ 'message' => __( 'Postman is <em>not</em> configured and is mimicking out-of-the-box WordPress email delivery.', Postman::TEXT_DOMAIN ),
+ );
}
}
}
diff --git a/Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/attachments.md b/Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/attachments.md
deleted file mode 100644
index 92f5090..0000000
--- a/Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/attachments.md
+++ /dev/null
@@ -1,47 +0,0 @@
-# Attachments
-
-You may attach a file from memory or by a file path.
-
-## From file path
-
-```php
-$mg->message()->send('example.com', [
- 'from' => 'bob@example.com',
- 'to' => 'sally@example.com',
- 'subject' => 'Test file path attachments',
- 'text' => 'Test',
- 'attachment' => [
- ['filePath'=>'/tmp/foo.jpg', 'filename'=>'test.jpg']
- ]
-]);
-```
-## From memory
-
-```php
-// Some how load the file to memory
-$binaryFile = '[Binary data]';
-
-$mg->message()->send('example.com', [
- 'from' => 'bob@example.com',
- 'to' => 'sally@example.com',
- 'subject' => 'Test memory attachments',
- 'text' => 'Test',
- 'attachment' => [
- ['fileContent'=>$binaryFile, 'filename'=>'test.jpg']
- ]
-]);
-```
-
-## Inline attachments
-
-```php
-$mg->message()->send('example.com', [
- 'from' => 'bob@example.com',
- 'to' => 'sally@example.com',
- 'subject' => 'Test inline attachments',
- 'text' => 'Test',
- 'inline' => [
- ['filePath'=>'/tmp/foo.jpg', 'filename'=>'test.jpg']
- ]
-]);
-```
diff --git a/Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/index.md b/Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/index.md
deleted file mode 100644
index 885d483..0000000
--- a/Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/index.md
+++ /dev/null
@@ -1,330 +0,0 @@
-# API documentation
-
-This page will document the API classes and ways to properly use the API. These resources will eventually move to
-the official documentation at [https://documentation.mailgun.com](https://documentation.mailgun.com/api_reference.html).
-
-Other relevant documentation pages might be:
-
-* [Attachments](attachments.md)
-* [Pagination](pagination.md)
-* [Message Builder](src/Mailgun/Messages/README.md) (Legacy code)
-* [Batch Message](src/Mailgun/Messages/README.md) (Legacy code)
-* [Opt-In Handler](src/Mailgun/Lists/README.md) (Legacy code)
-
-## Domain API
-
-#### Get a list of all domains
-
-```php
-$mailgun->domains()->index();
-```
-
-#### Show a single domains
-
-```php
-$mailgun->domains()->show('example.com');
-```
-
-#### Create a new domain
-
-```php
-$mailgun->domains()->create('new.example.com', 'password', 'disable', '*');
-```
-
-#### Delete a domain
-
-```php
-$mailgun->domains()->delete('example.com');
-```
-
-#### Get credentials for a domain
-
-```php
-$mailgun->domains()->credentials('example.com');
-```
-
-#### Create credentials for a domain
-
-```php
-$mailgun->domains()->createCredential('example.com', 'login', 'password');
-```
-
-#### Update credentials for a domain
-
-```php
-$mailgun->domains()->updateCredential('example.com', 'login', 'password');
-```
-
-#### Delete credentials for a domain
-
-```php
-$mailgun->domains()->deleteCredential('example.com', 'login');
-```
-
-#### Get connection for a domain
-
-```php
-$mailgun->domains()->connection('example.com');
-```
-
-#### Update connection for a domain
-
-```php
-$mailgun->domains()->updateConnection('example.com', true, false);
-```
-
-## Event API
-
-#### Get all events for a domain
-```php
-$mailgun->events()->get('example.com');
-```
-
-## Message API
-
-#### Send a message
-```php
-$parameters = [
- 'from' => 'bob@example.com',
- 'to' => 'sally@example.com',
- 'subject' => 'The PHP SDK is awesome!',
- 'text' => 'It is so simple to send a message.'
-];
-$mailgun->messages()->send('example.com', $parameters);
-```
-#### Send a message with Mime
-
-Below in an example how to create a Mime message with SwiftMailer.
-
-```php
-$message = \Swift_Message::newInstance('Mail Subject');
-$message->setFrom(['from@exemple.com' => 'Example Inc']);
-$message->setTo(['user0gmail.com' => 'User 0', 'user1@hotmail.com' => 'User 1']);
-// $message->setBcc('admin@example.com'); Do not do this, BCC will be visible for all receipients if you do.
-$message->setCc('invoice@example.com');
-
-$messageBody = 'Look at the <b>fancy</b> HTML body.';
-$message->setBody($messageBody, 'text/html');
-
-// We need all "tos". Incluce the BCC here.
-$to = ['admin@example.com', 'user0gmail.com', 'user1@hotmail.com', 'invoice@example.com']
-
-// Send the message
-$mailgun->messages()->sendMime('example.com', $to, $message->toString());
-```
-
-#### Show a stored message
-
-If you got an URL to a stored message you may get the details by:
-
-```php
-$url = // ...
-$mailgun->messages()->show($url);
-```
-
-## Route API
-
-#### Show all routes
-
-```php
-$mailgun->routes()->index();
-```
-
-#### Show a routes
-
-Get a route by its ID
-
-```php
-$mailgun->routes()->show(4711);
-```
-#### Create a route
-
-```php
-$expression = "match_recipient('.*@gmail.com')";
-$actions = ["forward('alice@example.com')"];
-$description = 'Test route';
-
-$mailgun->routes()->create($expression, $actions, $description);
-```
-
-#### Update a route
-
-```php
-$expression = "match_recipient('.*@gmail.com')";
-$actions = ["forward('alice@example.com')"];
-$description = 'Test route';
-
-$mailgun->routes()->update(4711, $expression, $actions, $description);
-```
-
-#### Delete a route
-```php
-$mailgun->routes()->delete(4711);
-```
-
-## Stats API
-
-#### Get total stats for a domain
-```php
-$mailgun->stats()->total('example.com');
-```
-
-#### Get all stats for a domain
-```php
-$mailgun->stats()->all('example.com');
-```
-
-## Suppression API
-
-The suppression API consists of 3 parts; `Bounce`, `Complaint` and `Unsubscribe`.
-
-### Bounce API
-#### Get all bounces
-```php
-$mailgun->suppressions()->bounces()->index('example.com');
-```
-
-#### Show bounces for a specific address
-```php
-$mailgun->suppressions()->bounces()->show('example.com', 'alice@gmail.com');
-```
-
-#### Create a bounce
-```php
-$mailgun->suppressions()->bounces()->create('example.com', 'alice@gmail.com');
-```
-
-#### Delete a bounce
-```php
-$mailgun->suppressions()->bounces()->delete('example.com', 'alice@gmail.com');
-```
-
-#### Delete all bounces
-```php
-$mailgun->suppressions()->bounces()->deleteAll('example.com');
-```
-
-### Complaint API
-#### Get all complaints
-```php
-$mailgun->suppressions()->complaints->index('example.com');
-```
-
-#### Show complaints for a specific address
-```php
-$mailgun->suppressions()->complaints()->show('example.com', 'alice@gmail.com');
-```
-
-#### Create a complaint
-```php
-$mailgun->suppressions()->complaints()->create('example.com', 'alice@gmail.com');
-```
-
-#### Delete a complaint
-```php
-$mailgun->suppressions()->complaints()->delete('example.com', 'alice@gmail.com');
-```
-
-#### Delete all complaints
-```php
-$mailgun->suppressions()->complaints()->deleteAll('example.com');
-```
-
-## Unsubscribe API
-
-#### Get all unsubscriptions
-```php
-$mailgun->suppressions()->unsubscribes()->index('example.com');
-```
-
-#### Show unsubscriptions for a specific address
-```php
-$mailgun->suppressions()->unsubscribes()->show('example.com', 'alice@gmail.com');
-```
-
-#### Create an unsubscription
-```php
-$mailgun->suppressions()->unsubscribes()->create('example.com', 'alice@gmail.com');
-```
-
-#### Delete an unsubscription
-```php
-$mailgun->suppressions()->unsubscribes()->delete('example.com', 'alice@gmail.com');
-```
-
-#### Delete all unsubscriptions
-```php
-$mailgun->suppressions()->unsubscribes()->deleteAll('example.com');
-```
-
-## Tag API
-
-#### Show all tags
-```php
-$mailgun->tags()->index('example.com');
-```
-
-#### Show a single tag
-```php
-$mailgun->tags()->show('example.com', 'foo');
-```
-
-#### Update a tag
-```php
-$mailgun->tags()->update('example.com', 'foo', 'description');
-```
-
-#### Show stats for a tag
-```php
-$mailgun->tags()->stats('example.com', 'foo');
-```
-
-#### Delete a tag
-```php
-$mailgun->tags()->delete('example.com', 'foo');
-```
-
-## Webhook API
-#### Verify webhook signature
-```php
-
-$timestamp = $_POST['timestamp'];
-$token = $_POST['token'];
-$signature = $_POST['signature'];
-
-$mailgun = Maingun::create('my_api_key');
-$valid = $mailgun->webhooks()->verifyWebhookSignature($timestamp, $token, $signature);
-
-if (!$valid) {
- // Create a 403 response
-
- exit();
-}
-
-// The signature is valid
-```
-
-#### Show all webhooks
-```php
-$mailgun->webhooks()->index('example.com');
-```
-
-#### Show a single webhooks
-```php
-$mailgun->webhooks()->show('example.com', 'accept');
-```
-
-#### Create a webhooks
-```php
-$mailgun->webhooks()->create('example.com', 'accept', 'https://www.exmple.com/webhook');
-```
-
-#### Update a webhooks
-```php
-$mailgun->webhooks()->update('example.com', 4711, 'https://www.exmple.com/webhook');
-```
-
-#### Delete a webhooks
-```php
-$mailgun->webhooks()->delete('example.com', 4711);
-```
diff --git a/Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/pagination.md b/Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/pagination.md
deleted file mode 100644
index 2fbcd5d..0000000
--- a/Postman/Postman-Mail/mailgun/vendor/mailgun/mailgun-php/doc/pagination.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# Pagination
-
-Some API endpoints do support pagination.
-
-```php
-
-/** @var Mailgun\Model\Tag\IndexReponse $response */
-$reponse = $mailgun->tags()->index('example.com');
-
-// Parse through the first response
-// ...
-
-$nextResponse = $mailgun->tags()->nextPage($response);
-$previousResponse = $mailgun->tags()->previousPage($response);
-$firstResponse = $mailgun->tags()->firstPage($response);
-$lastResponse = $mailgun->tags()->lastPage($response);
-```
diff --git a/Postman/Postman.php b/Postman/Postman.php
index b1779f2..8b83c38 100644
--- a/Postman/Postman.php
+++ b/Postman/Postman.php
@@ -367,15 +367,21 @@ class Postman {
if ( $this->logger->isDebug() ) {
$this->logger->debug( 'Displaying configuration required warning' );
}
- $message = sprintf( PostmanTransportRegistry::getInstance()->getReadyMessage() );
+ $msg = PostmanTransportRegistry::getInstance()->getReadyMessage();
+ $message = sprintf( $msg['message'] );
$goToSettings = sprintf( '<a href="%s">%s</a>', PostmanUtils::getSettingsPageUrl(), __( 'Settings', Postman::TEXT_DOMAIN ) );
$goToEmailLog = sprintf( '%s', _x( 'Email Log', 'The log of Emails that have been delivered', Postman::TEXT_DOMAIN ) );
if ( PostmanOptions::getInstance()->isMailLoggingEnabled() ) {
$goToEmailLog = sprintf( '<a href="%s">%s</a>', PostmanUtils::getEmailLogPageUrl(), $goToEmailLog );
}
$message .= (sprintf( ' %s | %s', $goToEmailLog, $goToSettings ));
- ;
- $this->messageHandler->printMessage( $message, PostmanMessageHandler::WARNING_CLASS );
+ $message .= '<input type="hidden" name="security" class="security" value="' . wp_create_nonce('postsmtp') . '">';
+
+ $hide = get_option('postman_release_version_not_configured' );
+
+ if ( $msg['error'] == true && ! $hide ) {
+ $this->messageHandler->printMessage( $message, 'postman-not-configured-notice notice notice-error is-dismissible' );
+ }
}
}
diff --git a/Postman/PostmanViewController.php b/Postman/PostmanViewController.php
index 35fb80a..49388f3 100644
--- a/Postman/PostmanViewController.php
+++ b/Postman/PostmanViewController.php
@@ -37,10 +37,18 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
// initialize the scripts, stylesheets and form fields
add_action( 'admin_init', array( $this, 'registerStylesAndScripts' ), 0 );
add_action( 'wp_ajax_delete_lock_file', array( $this, 'delete_lock_file' ) );
+ add_action( 'wp_ajax_dismiss_version_notify', array( $this, 'dismiss_version_notify' ) );
//add_action( 'admin_init', array( $this, 'do_activation_redirect' ) );
}
+ function dismiss_version_notify() {
+ check_ajax_referer( 'postsmtp', 'security' );
+
+ $version = sanitize_text_field($_POST['version']);
+ $result = update_option('postman_release_version_'. $version, true );
+ }
+
function delete_lock_file() {
check_ajax_referer( 'postman', 'security' );
@@ -169,7 +177,8 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
if ( ! PostmanPreRequisitesCheck::isReady() ) {
printf( '<p><span style="color:red; padding:2px 0; font-size:1.1em">%s</span></p>', __( 'Postman is unable to run. Email delivery is being handled by WordPress (or another plugin).', Postman::TEXT_DOMAIN ) );
} else {
- $statusMessage = PostmanTransportRegistry::getInstance()->getReadyMessage();
+ $ready_messsage = PostmanTransportRegistry::getInstance()->getReadyMessage();
+ $statusMessage = $ready_messsage['message'];
if ( PostmanTransportRegistry::getInstance()->getActiveTransport()->isConfiguredAndReady() ) {
if ( $this->options->getRunMode() != PostmanOptions::RUN_MODE_PRODUCTION ) {
printf( '<p><span style="background-color:yellow">%s</span></p>', $statusMessage );
@@ -290,7 +299,22 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
/**
*/
private function displayTopNavigation() {
+ $version = PostmanState::getInstance()->getVersion();
+ $show = get_option('postman_release_version_'. $version );
printf( '<h2>%s</h2>', sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) ) );
+
+ if ( ! $show ) {
+ echo '
+ <div class="updated settings-error notice is-dismissible">
+ <p>
+ <strong>Version ' . $version . ' released with Gmail upgrade and notifications:</strong> <a target="_blank" href="https://postmansmtp.com/post-smtp-1-8-4-best-wordpress-gmail-client">Read Here</a>
+ </p>
+ <button style="z-index: 100;" data-version="'. $version . '" data-security="' . wp_create_nonce('postsmtp') .'" type="button" class="notice-dismiss postman-release-message">
+ <span class="screen-reader-text">Dismiss this notice.</span>
+ </button>
+ </div>';
+ }
+
print '<div id="postman-main-menu" class="welcome-panel">';
print '<div class="welcome-panel-content">';
print '<div class="welcome-panel-column-container">';
diff --git a/Postman/notifications/PostmanMailNotify.php b/Postman/notifications/PostmanMailNotify.php
index a14a5f4..795afaa 100644
--- a/Postman/notifications/PostmanMailNotify.php
+++ b/Postman/notifications/PostmanMailNotify.php
@@ -7,6 +7,6 @@ class PostmanMailNotify implements Postman_Notify {
$to_email = get_bloginfo( 'admin_email' );
$domain = get_bloginfo( 'url' );
- mail( $to_email, "{$domain}: " . __( 'Post SMTP email error', Postman::TEXT_DOMAIN ), $message , null, "-f{$to_email}" );
+ mail( $to_email, "{$domain}: " . __( 'Post SMTP email error', Postman::TEXT_DOMAIN ), $message , '', "-f{$to_email}" );
}
} \ No newline at end of file
diff --git a/postman-smtp.php b/postman-smtp.php
index 4504808..3b8e88f 100644
--- a/postman-smtp.php
+++ b/postman-smtp.php
@@ -4,7 +4,7 @@
* Plugin Name: Post SMTP
* Plugin URI: https://wordpress.org/plugins/post-smtp/
* Description: Email not reliable? Post SMTP is the first and only WordPress SMTP plugin to implement OAuth 2.0 for Gmail, Hotmail and Yahoo Mail. Setup is a breeze with the Configuration Wizard and integrated Port Tester. Enjoy worry-free delivery even if your password changes!
- * Version: 1.8.3
+ * Version: 1.8.4
* Author: Jason Hendriks, Yehuda Hassine
* Text Domain: post-smtp
* Author URI: https://postmansmtp.com
@@ -58,6 +58,33 @@ function post_smtp_plugin_admin_notice() {
}
/**
+ * @todo
+ */
+function post_dismiss_not_configured() {
+ ?>
+ <script>
+ (function($) {
+ $(document).on('click','.postman-not-configured-notice .notice-dismiss', function(e) {
+ e.preventDefault();
+
+ var $this = $(this);
+ var args = {
+ action: 'dismiss_version_notify',
+ security: $('.postman-not-configured-notice').find('.security').val(),
+ version: 'not_configured',
+ };
+
+ $.post(ajaxurl, args, function() {
+ $this.parent().slideUp();
+ });
+ });
+ })(jQuery);
+ </script>
+<?php
+}
+add_action( 'admin_footer', 'post_dismiss_not_configured' );
+
+/**
* Create the main Postman class to start Postman
*
* @param unknown $startingMemory
@@ -72,5 +99,5 @@ function post_start( $startingMemory ) {
*/
function post_setupPostman() {
require_once 'Postman/Postman.php';
- $kevinCostner = new Postman( __FILE__, '1.8.3' );
+ $kevinCostner = new Postman( __FILE__, '1.8.4' );
}
diff --git a/readme.txt b/readme.txt
index 14e6a9f..66164db 100644
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yehuda@m
Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email, office365, mailgun
Requires at least: 3.9
Tested up to: 4.9.5
-Stable tag: 1.8.3
+Stable tag: 1.8.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -293,6 +293,11 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a
== Changelog ==
+= 1.8.4 - 2018-04-18
+* New: Multiple notification options to failed emails
+* Upgrade: The Gmail code was upgraded and code change to support large attachments
+* Add: Fix release lock file error
+* Change: "Not configured..." message is now dismissible
= 1.8.3 - 2018-03-21
* Fix: SendGrid API Call Structure (The previous try didn't work)
diff --git a/script/postman.js b/script/postman.js
index 0ae1947..0134430 100644
--- a/script/postman.js
+++ b/script/postman.js
@@ -1,6 +1,19 @@
jQuery(document).ready(function($) {
$( ".email-log-date" ).datepicker();
+ $('.notice-dismiss.postman-release-message').on('click', function() {
+ var $this = $(this);
+ var args = {
+ action: 'dismiss_version_notify',
+ security: $this.data('security'),
+ version: $this.data('version'),
+ };
+
+ $.post(ajaxurl, args, function() {
+ $this.parent().slideUp();
+ });
+ });
+
$('#postman_trash_all').on('click',function(e) {
if (confirm("Are You Sure?") == false) {
e.preventDefault();