updated plugin `WP Mail SMTP` version 2.3.1

This commit is contained in:
KawaiiPunk 2020-08-24 15:45:02 +00:00 committed by Gitium
parent be08bbbabd
commit fd5eaaad6c
66 changed files with 3703 additions and 1342 deletions

View File

@ -0,0 +1,3 @@
#wpadminbar .wp-mail-smtp-admin-bar-menu-notification-counter,#wpadminbar .wp-mail-smtp-admin-bar-menu-error{display:inline-block !important;vertical-align:top !important;box-sizing:border-box !important;margin:7px 0 0 2px !important;padding:0 5px !important;min-width:18px !important;height:18px !important;border-radius:9px !important;background-color:#ca4a1f !important;color:#fff !important;font-size:11px !important;line-height:1.6 !important;text-align:center !important}#wpadminbar .wp-mail-smtp-admin-bar-menu-notification-counter span,#wpadminbar .wp-mail-smtp-admin-bar-menu-error span{line-height:1 !important;font-size:11px !important}
/*# sourceMappingURL=admin-bar.min.css.map */

View File

@ -0,0 +1,3 @@
#wp-mail-smtp-notifications{position:relative;background:#FFFFFF 0 0 no-repeat padding-box;box-shadow:0 5px 15px #0000000D;border-radius:6px;opacity:1;min-height:48px;padding:15px 102px 15px 72px;margin:0 0 14px 0}#wp-mail-smtp-notifications *{box-sizing:border-box}#wp-mail-smtp-notifications .bell{position:absolute;top:15px;left:15px;width:42px;height:48px}#wp-mail-smtp-notifications .messages .message{display:none}#wp-mail-smtp-notifications .messages .message.current{display:block}#wp-mail-smtp-notifications .messages .message .title{font-weight:bold;font-size:17px;line-height:20px;margin:0;color:#444}#wp-mail-smtp-notifications .messages .message .content{font-weight:normal;font-size:13px;line-height:20px;margin:6px 0 40px 0}#wp-mail-smtp-notifications .messages .message .buttons{margin:-30px 80px 0 0}#wp-mail-smtp-notifications .messages .message .buttons a{margin:0 6px 0 0;padding:8px 10px;line-height:13px;font-size:13px;min-height:unset}#wp-mail-smtp-notifications .messages .message .buttons .button-secondary{border:1px solid #0071A1}#wp-mail-smtp-notifications .dismiss{position:absolute;top:15px;right:15px;width:16px;height:16px;color:#72777C;font-size:16px;cursor:pointer;text-align:center;vertical-align:middle;line-height:16px}#wp-mail-smtp-notifications .dismiss:hover{color:#dc3232}#wp-mail-smtp-notifications .navigation{position:absolute;bottom:15px;right:15px;width:63px;height:30px}#wp-mail-smtp-notifications .navigation a{display:block;width:30px;height:30px;border:1px solid #7E8993;border-radius:3px;font-size:8px;text-align:center;vertical-align:middle;line-height:30px;cursor:pointer;background-color:#ffffff;color:#41454A}#wp-mail-smtp-notifications .navigation a:hover{background-color:#f1f1f1}#wp-mail-smtp-notifications .navigation a .dashicons{margin-top:8px;font-size:12px}#wp-mail-smtp-notifications .navigation .prev{float:left}#wp-mail-smtp-notifications .navigation .next{float:right}#wp-mail-smtp-notifications .navigation .disabled{border-color:#dddddd;color:#A0A5AA;cursor:default}#wp-mail-smtp-notifications .navigation .disabled:hover{background-color:#ffffff}@media screen and (max-width: 768px){#wp-mail-smtp-notifications{padding:15px 15px 15px 72px}#wp-mail-smtp-notifications .messages .message .title{margin:0 30px 0 0}#wp-mail-smtp-notifications .messages .message .content{font-size:16px;line-height:24px}#wp-mail-smtp-notifications .messages .message .buttons{margin:-30px 80px 0 0}#wp-mail-smtp-notifications .messages .message .buttons a{margin:0;display:table}#wp-mail-smtp-notifications .messages .message .buttons .button-secondary{margin-top:6px}}
/*# sourceMappingURL=admin-notifications.min.css.map */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 562.3 193.9"><path fill="#dc7e28" d="M562.3 41.4v133.4l-18.1 18.1V62.3z"/><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="421.008" y1="59.066" x2="541.982" y2="192.343"><stop offset=".006" stop-color="#f8c51b"/><stop offset="1" stop-color="#e78f24"/></linearGradient><path fill="url(#a)" d="M422.3 62.3h122v130.6h-122z"/><path fill="#fdd600" d="M441.4 41.5l-19.1 20.8h121.9l18.1-20.9z"/><path fill="#90c7ea" d="M290.3 47.2l120-16.7-10.1 28.8-118.3 16.1z"/><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="286.163" y1="75.325" x2="410.923" y2="175.512"><stop offset=".006" stop-color="#1f8aca"/><stop offset="1" stop-color="#01659e"/></linearGradient><path fill="url(#b)" d="M400.2 59.3l16.7 117-118.3 16.6-16.7-117.5z"/><path fill="#0b98d5" d="M400.2 59.3l16.7 117 9-25.3-15.5-119.8-.1-.7"/><linearGradient id="c" gradientUnits="userSpaceOnUse" x1="218.128" y1="80.759" x2="218.128" y2="190.084"><stop offset="0" stop-color="#269f49"/><stop offset="1" stop-color="#008a54"/></linearGradient><path fill="url(#c)" d="M189 37.2l106.2 48-47.9 108.7L141.1 146z"/><path fill="#95cea0" d="M178 0l11 37.2 106.2 48-8.9-35.6z"/><path fill="#69bf6d" d="M178 0l-42.8 101.4 5.9 44.6L189 37.2z"/><linearGradient id="d" gradientUnits="userSpaceOnUse" x1="59.535" y1="70.064" x2="78.336" y2="183.568"><stop offset="0" stop-color="#d81f32"/><stop offset="1" stop-color="#bb2637"/></linearGradient><path fill="url(#d)" d="M118.7 59.1l17.5 115.2-117.3 18.4L0 77.3z"/><path fill="#761216" d="M126.7 17.2l17.4 116.2-7.9 40.9-17.5-115.2z"/><path d="M525.6 109.3c-2.4-6.1-6-11.5-10.7-16.3-4.5-4.6-9.6-8.1-15.2-10.4-5.6-2.3-11.7-3.5-18.2-3.5-6.6 0-12.7 1.2-18.4 3.5-5.7 2.3-10.7 5.8-15.2 10.4-4.7 4.7-8.3 10.2-10.6 16.2-2.4 6.1-3.5 12.7-3.5 19.8 0 7.1 1.2 13.7 3.6 19.8 2.4 6.1 5.9 11.6 10.6 16.4 4.4 4.5 9.4 8 15 10.3 5.6 2.3 11.8 3.5 18.5 3.5 6.5 0 12.5-1.2 18.2-3.5 5.6-2.3 10.7-5.7 15.3-10.3 4.7-4.8 8.3-10.3 10.7-16.4 2.4-6.1 3.6-12.7 3.6-19.8-.1-7-1.3-13.6-3.7-19.7zm-25.1 43c-4.7 5.6-11 8.4-19.1 8.5-8.2 0-14.5-2.8-19.2-8.4-4.7-5.6-7.1-13.4-7.1-23.3 0-10.1 2.4-18 7-23.6 4.7-5.7 11-8.5 19.2-8.5 8.1 0 14.4 2.8 19.1 8.5 4.7 5.7 7 13.5 7 23.6.2 9.9-2.2 17.6-6.9 23.2zM78.6 125.9zm27.5 30c-.9-1.1-2.2-1.9-3.7-2.5-1.6-.5-3.4-.8-5.7-.8-2.1 0-4.5.2-7.2.7l-31 5.3c.3-2.4 1.5-5.5 3.6-9.3 2.3-4.3 5.8-9.4 10.3-15.4 1.6-2.1 2.8-3.7 3.6-4.8.6-.7 1.4-1.8 2.5-3.2 7.1-9.3 11.5-16.9 13.2-22.8 1-3.4 1.5-6.8 1.8-10.2.1-.9.1-1.9.1-2.8 0-2.4-.2-4.9-.6-7.2-.4-2.2-.9-4-1.6-5.4-.7-1.4-1.6-2.5-2.7-3.2-1.3-.8-3-1.1-5.4-1.1-1.9 0-4.2.2-6.9.7L40.5 80c-4.3.7-7.5 2-9.6 3.9-1.6 1.5-2.5 3.5-2.5 5.8 0 .6.1 1.2.2 1.8.5 3 2.1 5.3 4.6 6.4 1.5.7 3.3 1 5.5 1 1.4 0 3-.2 4.8-.4l30-5.1c.1.5.1 1.1.1 1.6 0 1.9-.3 3.7-1 5.5-.9 2.5-3.1 6-6.7 10.5-1 1.2-2.5 3.1-4.6 5.7-8.1 9.8-13.9 18.1-17.4 25.1-2.5 4.8-4.2 9.5-5.2 14.1-.6 2.7-.8 5.3-.8 7.8 0 1.8.1 3.5.4 5.2.4 2.4 1 4.4 1.8 5.9.8 1.6 1.8 2.7 3.1 3.4 1.2.6 2.9.9 5.2.9 3 0 7-.4 12.1-1.3l32.5-5.6c5.8-1 9.8-2.4 12.1-4.3 1.9-1.5 2.8-3.6 2.8-6.1 0-.6-.1-1.3-.2-1.9-.1-1.5-.7-2.9-1.6-4zm147.3-77.8c-4.2-4.4-9.2-7.9-15.2-10.4-5.9-2.5-11.9-3.8-17.9-3.8h-.3c-6 .1-12 1.5-18 4.1-6.2 2.7-11.6 6.5-16.3 11.4-4.6 4.9-8.4 10.7-11.2 17.5-2.9 6.7-4.4 13.5-4.7 20.2 0 .8-.1 1.5-.1 2.3 0 6 1 11.8 3.1 17.5 2.2 6 5.4 11.2 9.6 15.6 4.2 4.4 9.4 7.9 15.5 10.5 5.9 2.5 11.8 3.7 17.8 3.7h.2c6.1 0 12.1-1.3 18-3.9 6.3-2.8 11.7-6.6 16.4-11.5 4.7-4.9 8.4-10.7 11.3-17.5 2.9-6.8 4.4-13.5 4.7-20.2v-1.9c0-6-1.1-12-3.2-17.7-2.3-6.2-5.5-11.5-9.7-15.9zm-11.6 47.4c-4 9.4-9.3 15.9-15.8 19.5-3.5 1.9-7.1 2.9-10.8 2.9-3.2 0-6.6-.7-10-2.2-7.4-3.2-12.1-8.3-14.1-15.4-.7-2.4-1-4.9-1-7.6 0-5.3 1.3-11.1 4-17.3 4.1-9.6 9.4-16.2 16-19.8 3.5-1.9 7.1-2.9 10.8-2.9 3.3 0 6.6.7 10.1 2.2 7.4 3.1 12 8.2 13.9 15.5.6 2.4 1 4.8 1 7.5 0 5.2-1.4 11.1-4.1 17.6zm138.3-43.8c-.5-3.6-1.8-6.4-3.8-8.2-1.6-1.5-3.6-2.2-5.9-2.2-.6 0-1.2 0-1.8.1-3.1.4-5.4 1.9-6.9 4.2-1 1.7-1.6 3.7-1.6 6.1 0 .9.1 1.9.2 2.8l4.3 30.4-34 5-4.3-30.4c-.5-3.5-1.7-6.3-3.7-8.1-1.6-1.5-3.6-2.3-5.9-2.3-.5 0-1.1 0-1.6.1-3.2.5-5.6 1.9-7.1 4.2-1.1 1.7-1.6 3.7-1.6 6.1 0 .9.1 1.9.2 2.9l11.6 79.2c.5 3.6 1.8 6.4 3.9 8.2 1.6 1.4 3.7 2.1 6 2.1.6 0 1.3-.1 2-.2 2.9-.4 5.2-1.8 6.6-4.2 1-1.7 1.5-3.7 1.5-6 0-.9-.1-1.9-.2-2.9l-4.8-31.3 34-5 4.8 31.3c.5 3.6 1.8 6.3 3.8 8.2 1.6 1.4 3.7 2.2 6 2.2.6 0 1.2 0 1.8-.1 3.1-.4 5.4-1.8 6.8-4.2 1-1.7 1.5-3.7 1.5-6 0-.9-.1-1.9-.2-2.9l-11.6-79.1z" fill="#fff"/><path fill="#ec473f" d="M0 77.3l2.3-11.6 5.9-29.5 118.5-19-8 41.9z"/></svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -165,10 +165,49 @@ WPMailSMTP.Admin.Settings = WPMailSMTP.Admin.Settings || ( function( document, w
target.select(); target.select();
document.execCommand( 'Copy' ); document.execCommand( 'Copy' );
var $buttonIcon = $( this ).find( '.dashicons' );
$buttonIcon
.removeClass( 'dashicons-admin-page' )
.addClass( 'dashicons-yes-alt wp-mail-smtp-success wp-mail-smtp-animate' );
setTimeout(
function() {
$buttonIcon
.removeClass( 'dashicons-yes-alt wp-mail-smtp-success wp-mail-smtp-animate' )
.addClass( 'dashicons-admin-page' );
},
1000
);
} );
// Notice bar: click on the dissmiss button.
$( '#wp-mail-smtp-notice-bar' ).on( 'click', '.dismiss', function() {
var $notice = $( this ).closest( '#wp-mail-smtp-notice-bar' );
$notice.addClass( 'out' );
setTimeout(
function() {
$notice.remove();
},
300
);
$.post(
ajaxurl,
{
action: 'wp_mail_smtp_notice_bar_dismiss',
nonce: wp_mail_smtp.nonce,
}
);
} ); } );
app.triggerExitNotice(); app.triggerExitNotice();
app.beforeSaveChecks(); app.beforeSaveChecks();
// Register change event to show/hide plugin supported settings for currently selected mailer.
$( '.js-wp-mail-smtp-setting-mailer-radio-input', app.pageHolder ).on( 'change', this.processMailerSettingsOnChange );
}, },
education: { education: {
@ -313,6 +352,43 @@ WPMailSMTP.Admin.Settings = WPMailSMTP.Admin.Settings || ( function( document, w
return false; return false;
} }
} ); } );
},
/**
* On change callback for showing/hiding plugin supported settings for currently selected mailer.
*
* @since 2.3.0
*/
processMailerSettingsOnChange: function() {
var mailerSupportedSettings = wp_mail_smtp.all_mailers_supports[ $( this ).val() ];
for ( var setting in mailerSupportedSettings ) {
// eslint-disable-next-line no-prototype-builtins
if ( mailerSupportedSettings.hasOwnProperty( setting ) ) {
$( '.js-wp-mail-smtp-setting-' + setting, app.pageHolder ).toggle( mailerSupportedSettings[ setting ] );
}
}
// Special case: "from email" (group settings).
var $mainSettingInGroup = $( '.js-wp-mail-smtp-setting-from_email' );
$mainSettingInGroup.closest( '.wp-mail-smtp-setting-row' ).toggle(
mailerSupportedSettings['from_email'] || mailerSupportedSettings['from_email_force']
);
$mainSettingInGroup.siblings( '.wp-mail-smtp-setting-mid-row-sep' ).toggle(
mailerSupportedSettings['from_email'] && mailerSupportedSettings['from_email_force']
);
// Special case: "from name" (group settings).
$mainSettingInGroup = $( '.js-wp-mail-smtp-setting-from_name' );
$mainSettingInGroup.closest( '.wp-mail-smtp-setting-row' ).toggle(
mailerSupportedSettings['from_name'] || mailerSupportedSettings['from_name_force']
);
$mainSettingInGroup.siblings( '.wp-mail-smtp-setting-mid-row-sep' ).toggle(
mailerSupportedSettings['from_name'] && mailerSupportedSettings['from_name_force']
);
} }
}; };

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,185 @@
/* global wp_mail_smtp, ajaxurl */
/**
* WP Mail SMTP Admin Notifications.
*
* @since 2.3.0
*/
'use strict';
var WPMailSMTPAdminNotifications = window.WPMailSMTPAdminNotifications || ( function( document, window, $ ) {
/**
* Elements holder.
*
* @since 2.3.0
*
* @type {object}
*/
var el = {
$notifications: $( '#wp-mail-smtp-notifications' ),
$nextButton: $( '#wp-mail-smtp-notifications .navigation .next' ),
$prevButton: $( '#wp-mail-smtp-notifications .navigation .prev' ),
$adminBarCounter: $( '#wp-admin-bar-wp-mail-smtp-menu .wp-mail-smtp-admin-bar-menu-notification-counter' ),
};
/**
* Public functions and properties.
*
* @since 2.3.0
*
* @type {object}
*/
var app = {
/**
* Start the engine.
*
* @since 2.3.0
*/
init: function() {
$( document ).ready( app.ready );
},
/**
* Document ready.
*
* @since 2.3.0
*/
ready: function() {
app.updateNavigation();
app.events();
},
/**
* Register JS events.
*
* @since 2.3.0
*/
events: function() {
el.$notifications
.on( 'click', '.dismiss', app.dismiss )
.on( 'click', '.next', app.navNext )
.on( 'click', '.prev', app.navPrev );
},
/**
* Click on the Dismiss notification button.
*
* @since 2.3.0
*
* @param {object} event Event object.
*/
dismiss: function( event ) {
if ( el.$currentMessage.length === 0 ) {
return;
}
// AJAX call - update option.
var data = {
action: 'wp_mail_smtp_notification_dismiss',
nonce: wp_mail_smtp.nonce,
id: el.$currentMessage.data( 'message-id' ),
};
$.post( ajaxurl, data, function( response ) {
if ( ! response.success ) {
return;
}
// Update counter.
var count = parseInt( el.$adminBarCounter.text(), 10 );
if ( count > 1 ) {
--count;
el.$adminBarCounter.html( '<span>' + count + '</span>' );
} else {
el.$adminBarCounter.remove();
}
// Remove notification.
var $nextMessage = el.$nextMessage.length < 1 ? el.$prevMessage : el.$nextMessage;
if ( $nextMessage.length === 0 ) {
el.$notifications.remove();
} else {
el.$currentMessage.remove();
$nextMessage.addClass( 'current' );
app.updateNavigation();
}
} );
},
/**
* Click on the Next notification button.
*
* @since 2.3.0
*
* @param {object} event Event object.
*/
navNext: function( event ) {
if ( el.$nextButton.hasClass( 'disabled' ) ) {
return;
}
el.$currentMessage.removeClass( 'current' );
el.$nextMessage.addClass( 'current' );
app.updateNavigation();
},
/**
* Click on the Previous notification button.
*
* @since 2.3.0
*
* @param {object} event Event object.
*/
navPrev: function( event ) {
if ( el.$prevButton.hasClass( 'disabled' ) ) {
return;
}
el.$currentMessage.removeClass( 'current' );
el.$prevMessage.addClass( 'current' );
app.updateNavigation();
},
/**
* Update navigation buttons.
*
* @since 2.3.0
*/
updateNavigation: function() {
el.$currentMessage = el.$notifications.find( '.message.current' );
el.$nextMessage = el.$currentMessage.next( '.message' );
el.$prevMessage = el.$currentMessage.prev( '.message' );
if ( el.$nextMessage.length === 0 ) {
el.$nextButton.addClass( 'disabled' );
} else {
el.$nextButton.removeClass( 'disabled' );
}
if ( el.$prevMessage.length === 0 ) {
el.$prevButton.addClass( 'disabled' );
} else {
el.$prevButton.removeClass( 'disabled' );
}
},
};
return app;
}( document, window, jQuery ) );
// Initialize.
WPMailSMTPAdminNotifications.init();

View File

@ -0,0 +1 @@
"use strict";var WPMailSMTPAdminNotifications=window.WPMailSMTPAdminNotifications||function(e,t){var a={$notifications:t("#wp-mail-smtp-notifications"),$nextButton:t("#wp-mail-smtp-notifications .navigation .next"),$prevButton:t("#wp-mail-smtp-notifications .navigation .prev"),$adminBarCounter:t("#wp-admin-bar-wp-mail-smtp-menu .wp-mail-smtp-admin-bar-menu-notification-counter")},s={init:function(){t(e).ready(s.ready)},ready:function(){s.updateNavigation(),s.events()},events:function(){a.$notifications.on("click",".dismiss",s.dismiss).on("click",".next",s.navNext).on("click",".prev",s.navPrev)},dismiss:function(e){if(0!==a.$currentMessage.length){var n={action:"wp_mail_smtp_notification_dismiss",nonce:wp_mail_smtp.nonce,id:a.$currentMessage.data("message-id")};t.post(ajaxurl,n,function(e){if(e.success){var n=parseInt(a.$adminBarCounter.text(),10);1<n?(--n,a.$adminBarCounter.html("<span>"+n+"</span>")):a.$adminBarCounter.remove();var t=a.$nextMessage.length<1?a.$prevMessage:a.$nextMessage;0===t.length?a.$notifications.remove():(a.$currentMessage.remove(),t.addClass("current"),s.updateNavigation())}})}},navNext:function(e){a.$nextButton.hasClass("disabled")||(a.$currentMessage.removeClass("current"),a.$nextMessage.addClass("current"),s.updateNavigation())},navPrev:function(e){a.$prevButton.hasClass("disabled")||(a.$currentMessage.removeClass("current"),a.$prevMessage.addClass("current"),s.updateNavigation())},updateNavigation:function(){a.$currentMessage=a.$notifications.find(".message.current"),a.$nextMessage=a.$currentMessage.next(".message"),a.$prevMessage=a.$currentMessage.prev(".message"),0===a.$nextMessage.length?a.$nextButton.addClass("disabled"):a.$nextButton.removeClass("disabled"),0===a.$prevMessage.length?a.$prevButton.addClass("disabled"):a.$prevButton.removeClass("disabled")}};return s}(document,(window,jQuery));WPMailSMTPAdminNotifications.init();

View File

@ -1,9 +1,9 @@
=== WP Mail SMTP by WPForms === === WP Mail SMTP by WPForms ===
Contributors: wpforms, jaredatch, smub, slaFFik Contributors: wpforms, jaredatch, smub, slaFFik
Tags: smtp, wp mail smtp, wordpress smtp, gmail smtp, sendgrid smtp, mailgun smtp, mail, mailer, phpmailer, wp_mail, email, mailgun, sengrid, gmail, pepipost, sendinblue, wp smtp Tags: smtp, wp mail smtp, wordpress smtp, gmail smtp, sendgrid smtp, mailgun smtp, mail, mailer, phpmailer, wp_mail, email, mailgun, sengrid, gmail, sendinblue, wp smtp
Requires at least: 4.9 Requires at least: 4.9
Tested up to: 5.4 Tested up to: 5.5
Stable tag: 2.2.1 Stable tag: 2.3.1
Requires PHP: 5.5.0 Requires PHP: 5.5.0
The most popular WordPress SMTP and PHP Mailer plugin. Trusted by over 1 million sites. The most popular WordPress SMTP and PHP Mailer plugin. Trusted by over 1 million sites.
@ -22,7 +22,7 @@ WP Mail SMTP fixes your email deliverability by reconfiguring WordPress to use a
SMTP (Simple Mail Transfer Protocol) is an industry standard for sending emails. Proper SMTP configuration helps increase email deliverability by using authentication. SMTP (Simple Mail Transfer Protocol) is an industry standard for sending emails. Proper SMTP configuration helps increase email deliverability by using authentication.
Popular email clients like Gmail, Yahoo, and Office 365 are in a constant battle with email spammers. One of the things they look at is if an email is originating from the location it claims to be originating from. Popular email clients like Gmail, Yahoo, Office 365, and Zoho are in a constant battle with email spammers. One of the things they look at is if an email is originating from the location it claims to be originating from.
If the proper authentication isn't there, then emails either go in the SPAM folder or worst, don't get delivered at all. If the proper authentication isn't there, then emails either go in the SPAM folder or worst, don't get delivered at all.
@ -43,16 +43,16 @@ This helps you fix all WordPress not sending email issues.
WP Mail SMTP plugin includes many different SMTP setup options: WP Mail SMTP plugin includes many different SMTP setup options:
1. SMTP.com <strong>(Recommended)</strong> 1. SMTP.com <strong>(Recommended)</strong>
2. Pepipost SMTP <strong>(Recommended)</strong> 2. Sendinblue SMTP
3. Sendinblue SMTP 3. Mailgun SMTP
4. Mailgun SMTP 4. SendGrid SMTP
5. SendGrid SMTP 5. Gmail SMTP
6. Gmail SMTP 6. Microsoft SMTP (Outlook.com and Office 365) <a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend">[Pro]</a>
7. Microsoft SMTP (Outlook.com and Office 365) <a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend">[Pro]</a> 7. Amazon SES SMTP <a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend">[Pro]</a>
8. Amazon SES SMTP <a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend">[Pro]</a> 8. Zoho Mail SMTP <a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend">[Pro]</a>
9. All Other SMTP 9. All Other SMTP
For all options, you can specify the "from name" and "email address" for outgoing emails. For most options, you can specify the "from name" and "email address" for outgoing emails.
Instead of having users use different SMTP plugins and workflows for different SMTP providers, we decided to bring it all in one. This is what makes WP Mail SMTP, the best SMTP solution for WordPress. Instead of having users use different SMTP plugins and workflows for different SMTP providers, we decided to bring it all in one. This is what makes WP Mail SMTP, the best SMTP solution for WordPress.
@ -66,17 +66,6 @@ Their easy integration process lets you start sending emails in minutes and bene
Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-smtp-com-mailer-in-wp-mail-smtp" rel="friend">SMTP.com documentation</a> for more details. Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-smtp-com-mailer-in-wp-mail-smtp" rel="friend">SMTP.com documentation</a> for more details.
= Pepipost SMTP =
Pepipost is a recommended transactional email service.
Every month they delivers over 8 billion emails from 20,000+ customers.
Their mission is to reliably send emails in the most efficient way and at the most disruptive pricing ever.
Pepipost provides users 30,000 emails the first 30 days.
Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-pepipost-mailer-in-wp-mail-smtp/" rel="friend">Pepipost documentation</a> for more details.
= Sendinblue SMTP = = Sendinblue SMTP =
They serve 80,000+ growing companies around the world and send over 30 million emails each day. They serve 80,000+ growing companies around the world and send over 30 million emails each day.
@ -119,6 +108,12 @@ Advanced or technical users can harness the power of Amazon AWS (Amazon Web Serv
Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-amazon-ses-mailer-in-wp-mail-smtp/" rel="friend">Amazon SES documentation</a> for more details. Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-amazon-ses-mailer-in-wp-mail-smtp/" rel="friend">Amazon SES documentation</a> for more details.
= Zoho Mail SMTP =
Send emails using your personal or business Zoho Mail account, all while keeping your login credentials safe.
Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-zoho-mailer-in-wp-mail-smtp/" rel="friend">Zoho Mail documentation</a> for more details.
= Other SMTP = = Other SMTP =
WP Mail SMTP plugin also works with all major email services such as Gmail, Yahoo, Outlook, Microsoft Live, and any other email sending service that offers SMTP. WP Mail SMTP plugin also works with all major email services such as Gmail, Yahoo, Outlook, Microsoft Live, and any other email sending service that offers SMTP.
@ -163,7 +158,7 @@ You can sit back and relax while we set up everything for you. White glove setup
The WP Mail SMTP team takes security very seriously. Not only does the plugin follow all security best practices, but we have several options available to ensure your site is safe and secure. The WP Mail SMTP team takes security very seriously. Not only does the plugin follow all security best practices, but we have several options available to ensure your site is safe and secure.
- Direct SMTP mailer integrations (recommended), such as SMTP.com, Pepipost and Mailgun, use the official provider APIs. This means you never enter your username or password in the plugin settings and these credentials are not stored in the database. Instead, we use tokens or API keys which are much more secure. - Direct SMTP mailer integrations (recommended), such as SMTP.com, SendGrid and Mailgun, use the official provider APIs. This means you never enter your username or password in the plugin settings and these credentials are not stored in the database. Instead, we use tokens or API keys which are much more secure.
- When using Other SMTP mailer, we provide the option to insert your password in your `wp-config.php` file, so it's not visible in your WordPress settings or saved in the database. - When using Other SMTP mailer, we provide the option to insert your password in your `wp-config.php` file, so it's not visible in your WordPress settings or saved in the database.
@ -229,6 +224,17 @@ By all means please contact us to discuss features or options you'd like to see
== Changelog == == Changelog ==
= 2.3.1 - 2020-08-20 =
* Added: A WP Mail SMTP admin bar menu if there is an email delivery error or notifications.
* Added: WordPress 5.5 compatibility.
* Changed: Improve copy button user experience for Gmail Authorized redirect URI option.
* Changed: Email delivery error admin notices are now displayed only on plugin pages.
* Changed: Improve plugin settings UI by hiding certain options if the mailer does not support them.
* Changed: Pepipost API mailer is no longer available for new installs.
* Fixed: WP Site Health check for missing DB tables.
* Fixed: PHP errors caused by Actions Scheduler library used inside the plugin.
* Fixed: PHP error on plugin settings and WP Site Health pages if the plugin mailer option is empty for some reason.
= 2.2.1 - 2020-07-09 = = 2.2.1 - 2020-07-09 =
* Added: Gmail mailer now supports aliases. * Added: Gmail mailer now supports aliases.
* Added: Support both old PHPMailer v5 (WordPress <=5.4) and PHPMailer v6 (WordPress >=5.5). * Added: Support both old PHPMailer v5 (WordPress <=5.4) and PHPMailer v6 (WordPress >=5.5).

View File

@ -0,0 +1,153 @@
<?php
namespace WPMailSMTP\Admin;
use WPMailSMTP\Debug;
/**
* WP Mail SMTP admin bar menu.
*
* @since 2.3.0
*/
class AdminBarMenu {
/**
* Initialize class.
*
* @since 2.3.0
*/
public function init() {
$this->hooks();
}
/**
* Register hooks.
*
* @since 2.3.0
*/
public function hooks() {
add_action( 'wp_enqueue_scripts', [ $this, 'enqueues' ] );
add_action( 'admin_enqueue_scripts', [ $this, 'enqueues' ] );
add_action( 'admin_bar_menu', [ $this, 'register' ], 999 );
}
/**
* Check if current user has access to see admin bar menu.
*
* @since 2.3.0
*
* @return bool
*/
public function has_access() {
$access = false;
if (
is_user_logged_in() &&
current_user_can( 'manage_options' )
) {
$access = true;
}
return apply_filters( 'wp_mail_smtp_admin_adminbarmenu_has_access', $access );
}
/**
* Check if new notifications are available.
*
* @since 2.3.0
*
* @return bool
*/
public function has_notifications() {
return wp_mail_smtp()->get_notifications()->get_count();
}
/**
* Enqueue styles.
*
* @since 2.3.0
*/
public function enqueues() {
if ( ! $this->has_access() ) {
return;
}
wp_enqueue_style(
'wp-mail-smtp-admin-bar',
wp_mail_smtp()->assets_url . '/css/admin-bar.min.css',
[],
WPMS_PLUGIN_VER
);
}
/**
* Register and render admin menu bar.
*
* @since 2.3.0
*
* @param \WP_Admin_Bar $wp_admin_bar WordPress Admin Bar object.
*/
public function register( \WP_Admin_Bar $wp_admin_bar ) {
if (
! $this->has_access() ||
(
empty( Debug::get_last() ) &&
empty( $this->has_notifications() )
)
) {
return;
}
$items = apply_filters(
'wp_mail_smtp_admin_adminbarmenu_register',
[
'main_menu',
],
$wp_admin_bar
);
foreach ( $items as $item ) {
$this->{ $item }( $wp_admin_bar );
do_action( "wp_mail_smtp_admin_adminbarmenu_register_{$item}_after", $wp_admin_bar );
}
}
/**
* Render primary top-level admin menu bar item.
*
* @since 2.3.0
*
* @param \WP_Admin_Bar $wp_admin_bar WordPress Admin Bar object.
*/
public function main_menu( \WP_Admin_Bar $wp_admin_bar ) {
if ( ! empty( Debug::get_last() ) ) {
$indicator = ' <span class="wp-mail-smtp-admin-bar-menu-error">!</span>';
} elseif ( ! empty( $this->has_notifications() ) ) {
$count = $this->has_notifications() < 10 ? $this->has_notifications() : '!';
$indicator = ' <div class="wp-mail-smtp-admin-bar-menu-notification-counter"><span>' . $count . '</span></div>';
}
if ( ! isset( $indicator ) ) {
return;
}
$wp_admin_bar->add_menu(
[
'id' => 'wp-mail-smtp-menu',
'title' => 'WP Mail SMTP' . $indicator,
'href' => apply_filters(
'wp_mail_smtp_admin_adminbarmenu_main_menu_href',
wp_mail_smtp()->get_admin()->get_admin_page_url()
),
]
);
}
}

View File

@ -99,6 +99,7 @@ class Area {
add_action( 'wp_ajax_wp_mail_smtp_ajax', [ $this, 'process_ajax' ] ); add_action( 'wp_ajax_wp_mail_smtp_ajax', [ $this, 'process_ajax' ] );
( new Review() )->hooks(); ( new Review() )->hooks();
( new Education() )->hooks();
} }
/** /**
@ -128,7 +129,6 @@ class Area {
break; break;
case 'google_no_code_scope': case 'google_no_code_scope':
case 'microsoft_no_code':
WP::add_admin_notice( WP::add_admin_notice(
esc_html__( 'There was an error while processing the authentication request. Please try again.', 'wp-mail-smtp' ), esc_html__( 'There was an error while processing the authentication request. Please try again.', 'wp-mail-smtp' ),
WP::ADMIN_NOTICE_ERROR WP::ADMIN_NOTICE_ERROR
@ -150,12 +150,6 @@ class Area {
WP::ADMIN_NOTICE_SUCCESS WP::ADMIN_NOTICE_SUCCESS
); );
break; break;
case 'microsoft_site_linked':
WP::add_admin_notice(
esc_html__( 'You have successfully linked the current site with your Microsoft API project. Now you can start sending emails through Outlook.', 'wp-mail-smtp' ),
WP::ADMIN_NOTICE_SUCCESS
);
break;
} }
} }
@ -316,7 +310,7 @@ class Area {
'upgrade_icon_lock' => '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="lock" class="svg-inline--fa fa-lock fa-w-14" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z"></path></svg>', 'upgrade_icon_lock' => '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="lock" class="svg-inline--fa fa-lock fa-w-14" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z"></path></svg>',
'upgrade_title' => esc_html__( '%name% is a PRO Feature', 'wp-mail-smtp' ), 'upgrade_title' => esc_html__( '%name% is a PRO Feature', 'wp-mail-smtp' ),
'upgrade_button' => esc_html__( 'Upgrade to Pro', 'wp-mail-smtp' ), 'upgrade_button' => esc_html__( 'Upgrade to Pro', 'wp-mail-smtp' ),
'upgrade_url' => 'https://wpmailsmtp.com/lite-upgrade/?discount=SMTPLITEUPGRADE&utm_source=WordPress&utm_medium=plugin-settings&utm_campaign=liteplugin', 'upgrade_url' => add_query_arg( 'discount', 'SMTPLITEUPGRADE', wp_mail_smtp()->get_upgrade_link( '' ) ),
'upgrade_bonus' => '<p>' . 'upgrade_bonus' => '<p>' .
wp_kses( wp_kses(
__( '<strong>Bonus:</strong> WP Mail SMTP users get <span>$50 off</span> regular price,<br>applied at checkout.', 'wp-mail-smtp' ), __( '<strong>Bonus:</strong> WP Mail SMTP users get <span>$50 off</span> regular price,<br>applied at checkout.', 'wp-mail-smtp' ),
@ -331,6 +325,8 @@ class Area {
' . esc_html__( 'Already purchased?', 'wp-mail-smtp' ) . ' ' . esc_html__( 'Already purchased?', 'wp-mail-smtp' ) . '
</a>', </a>',
), ),
'all_mailers_supports' => wp_mail_smtp()->get_providers()->get_supports_all(),
'nonce' => wp_create_nonce( 'wp-mail-smtp-admin' ),
) )
); );
@ -435,6 +431,8 @@ class Area {
if ( ! $this->is_admin_page() ) { if ( ! $this->is_admin_page() ) {
return; return;
} }
do_action( 'wp_mail_smtp_admin_header_before' );
?> ?>
<div id="wp-mail-smtp-header-temp"></div> <div id="wp-mail-smtp-header-temp"></div>
@ -590,6 +588,8 @@ class Area {
<?php echo esc_html( $this->get_current_tab_title() ); ?> <?php echo esc_html( $this->get_current_tab_title() ); ?>
</h1> </h1>
<?php do_action( 'wp_mail_smtp_admin_pages_before_content' ); ?>
<?php $this->display_current_tab_content(); ?> <?php $this->display_current_tab_content(); ?>
</div> </div>

View File

@ -0,0 +1,102 @@
<?php
namespace WPMailSMTP\Admin;
/**
* WP Mail SMTP enhancements to admin pages to educate Lite users on what is available in WP Mail SMTP Pro.
*
* @since 2.3.0
*/
class Education {
/**
* The dismissed notice bar user meta key.
*
* @since 2.3.0
*/
const DISMISS_NOTICE_BAR_KEY = 'wp_mail_smtp_edu_notice_bar_dismissed';
/**
* Hooks.
*
* @since 2.3.0
*/
public function hooks() {
if ( apply_filters( 'wp_mail_smtp_admin_education_notice_bar', true ) ) {
add_action( 'admin_init', [ $this, 'notice_bar_init' ] );
}
}
/**
* Notice bar init.
*
* @since 2.3.0
*/
public function notice_bar_init() {
add_action( 'wp_mail_smtp_admin_header_before', [ $this, 'notice_bar_display' ] );
add_action( 'wp_ajax_wp_mail_smtp_notice_bar_dismiss', [ $this, 'notice_bar_ajax_dismiss' ] );
}
/**
* Notice bar display message.
*
* @since 2.3.0
*/
public function notice_bar_display() {
// Bail if we're not on a plugin admin page.
if ( ! wp_mail_smtp()->get_admin()->is_admin_page() ) {
return;
}
$dismissed = get_user_meta( get_current_user_id(), self::DISMISS_NOTICE_BAR_KEY, true );
if ( ! empty( $dismissed ) ) {
return;
}
printf(
'<div id="wp-mail-smtp-notice-bar">
<div class="wp-amil-smtp-notice-bar-container">
<span class="wp-mail-smtp-notice-bar-message">%s</span>
<button type="button" class="dismiss" title="%s" />
</div>
</div>',
wp_kses(
sprintf( /* translators: %s - WPMailSMTP.com Upgrade page URL. */
__( 'Youre using WP Mail SMTP Lite. To unlock more features consider <a href="%s" target="_blank" rel="noopener noreferrer">upgrading to Pro</a>.', 'wp-mail-smtp' ),
wp_mail_smtp()->get_upgrade_link( [ 'medium' => 'notice-bar' ] )
),
[
'a' => [
'href' => [],
'rel' => [],
'target' => [],
],
]
),
esc_attr__( 'Dismiss this message.', 'wp-mail-smtp' )
);
}
/**
* Ajax handler for dismissing notices.
*
* @since 2.3.0
*/
public function notice_bar_ajax_dismiss() {
// Run a security check.
check_ajax_referer( 'wp-mail-smtp-admin', 'nonce' );
// Check for permissions.
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error();
}
update_user_meta( get_current_user_id(), self::DISMISS_NOTICE_BAR_KEY, time() );
wp_send_json_success();
}
}

View File

@ -0,0 +1,491 @@
<?php
namespace WPMailSMTP\Admin;
use WPMailSMTP\Options;
use WPMailSMTP\WP;
/**
* Notifications.
*
* @since 2.3.0
*/
class Notifications {
/**
* Source of notifications content.
*
* @since 2.3.0
*
* @var string
*/
const SOURCE_URL = 'https://plugin-cdn.wpmailsmtp.com/wp-content/notifications.json';
/**
* The WP option key for storing the notification options.
*
* @since 2.3.0
*
* @var string
*/
const OPTION_KEY = 'wp_mail_smtp_notifications';
/**
* Option value.
*
* @since 2.3.0
*
* @var bool|array
*/
public $option = false;
/**
* Initialize class.
*
* @since 2.3.0
*/
public function init() {
$this->hooks();
}
/**
* Register hooks.
*
* @since 2.3.0
*/
public function hooks() {
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
add_action( 'wp_mail_smtp_admin_pages_before_content', [ $this, 'output' ] );
add_action( 'wp_mail_smtp_admin_notifications_update', [ $this, 'update' ] );
add_action( 'wp_ajax_wp_mail_smtp_notification_dismiss', [ $this, 'dismiss' ] );
}
/**
* Check if user has access and is enabled.
*
* @since 2.3.0
*
* @return bool
*/
public function has_access() {
$access = false;
if (
current_user_can( 'manage_options' ) &&
! ( new Options() )->get( 'general', 'am_notifications_hidden' )
) {
$access = true;
}
return apply_filters( 'wp_mail_smtp_admin_notifications_has_access', $access );
}
/**
* Get option value.
*
* @since 2.3.0
*
* @param bool $cache Reference property cache if available.
*
* @return array
*/
public function get_option( $cache = true ) {
if ( $this->option && $cache ) {
return $this->option;
}
$option = get_option( self::OPTION_KEY, [] );
$this->option = [
'update' => ! empty( $option['update'] ) ? $option['update'] : 0,
'events' => ! empty( $option['events'] ) ? $option['events'] : [],
'feed' => ! empty( $option['feed'] ) ? $option['feed'] : [],
'dismissed' => ! empty( $option['dismissed'] ) ? $option['dismissed'] : [],
];
return $this->option;
}
/**
* Fetch notifications from feed.
*
* @since 2.3.0
*
* @return array
*/
protected function fetch_feed() {
$response = wp_remote_get( self::SOURCE_URL );
if ( is_wp_error( $response ) ) {
return [];
}
$body = wp_remote_retrieve_body( $response );
if ( empty( $body ) ) {
return [];
}
return $this->verify( json_decode( $body, true ) );
}
/**
* Verify notification data before it is saved.
*
* @since 2.3.0
*
* @param array $notifications Array of notification items to verify.
*
* @return array
*/
protected function verify( $notifications ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
$data = [];
if ( ! is_array( $notifications ) || empty( $notifications ) ) {
return $data;
}
$option = $this->get_option();
foreach ( $notifications as $notification ) {
// The message and license should never be empty, if they are, ignore.
if ( empty( $notification['content'] ) || empty( $notification['type'] ) ) {
continue;
}
// Ignore if license type does not match.
if ( ! in_array( wp_mail_smtp()->get_license_type(), $notification['type'], true ) ) {
continue;
}
// Ignore if expired.
if ( ! empty( $notification['end'] ) && time() > strtotime( $notification['end'] ) ) {
continue;
}
// Ignore if notification has already been dismissed.
if ( ! empty( $option['dismissed'] ) && in_array( $notification['id'], $option['dismissed'] ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
continue;
}
// Ignore if notification existed before installing WPForms.
// Prevents bombarding the user with notifications after activation.
$activated = get_option( 'wp_mail_smtp_activated_time' );
if (
! empty( $activated ) &&
! empty( $notification['start'] ) &&
$activated > strtotime( $notification['start'] )
) {
continue;
}
$data[] = $notification;
}
return $data;
}
/**
* Verify saved notification data for active notifications.
*
* @since 2.3.0
*
* @param array $notifications Array of notification items to verify.
*
* @return array
*/
protected function verify_active( $notifications ) {
if ( ! is_array( $notifications ) || empty( $notifications ) ) {
return [];
}
// Remove notifications that are not active.
foreach ( $notifications as $key => $notification ) {
if (
( ! empty( $notification['start'] ) && time() < strtotime( $notification['start'] ) ) ||
( ! empty( $notification['end'] ) && time() > strtotime( $notification['end'] ) )
) {
unset( $notifications[ $key ] );
}
}
return $notifications;
}
/**
* Get notification data.
*
* @since 2.3.0
*
* @return array
*/
public function get() {
if ( ! $this->has_access() ) {
return [];
}
$option = $this->get_option();
// Update notifications using async task.
if ( empty( $option['update'] ) || time() > $option['update'] + DAY_IN_SECONDS ) {
if ( empty( wp_mail_smtp()->get_tasks()->is_scheduled( 'wp_mail_smtp_admin_notifications_update' ) ) ) {
wp_mail_smtp()->get_tasks()
->create( 'wp_mail_smtp_admin_notifications_update' )
->async()
->params()
->register();
}
}
$events = ! empty( $option['events'] ) ? $this->verify_active( $option['events'] ) : [];
$feed = ! empty( $option['feed'] ) ? $this->verify_active( $option['feed'] ) : [];
return array_merge( $events, $feed );
}
/**
* Get notification count.
*
* @since 2.3.0
*
* @return int
*/
public function get_count() {
return count( $this->get() );
}
/**
* Add a manual notification event.
*
* @since 2.3.0
*
* @param array $notification Notification data.
*/
public function add( $notification ) {
if ( empty( $notification['id'] ) ) {
return;
}
$option = $this->get_option();
if ( in_array( $notification['id'], $option['dismissed'] ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
return;
}
foreach ( $option['events'] as $item ) {
if ( $item['id'] === $notification['id'] ) {
return;
}
}
$notification = $this->verify( [ $notification ] );
update_option(
self::OPTION_KEY,
[
'update' => $option['update'],
'feed' => $option['feed'],
'events' => array_merge( $notification, $option['events'] ),
'dismissed' => $option['dismissed'],
]
);
}
/**
* Update notification data from feed.
*
* @since 2.3.0
*/
public function update() {
$feed = $this->fetch_feed();
$option = $this->get_option();
update_option(
self::OPTION_KEY,
[
'update' => time(),
'feed' => $feed,
'events' => $option['events'],
'dismissed' => $option['dismissed'],
]
);
}
/**
* Admin area assets.
*
* @since 2.3.0
*
* @param string $hook Hook suffix for the current admin page.
*/
public function enqueue_assets( $hook ) {
if ( strpos( $hook, Area::SLUG ) === false ) {
return;
}
if ( ! $this->has_access() ) {
return;
}
$notifications = $this->get();
if ( empty( $notifications ) ) {
return;
}
wp_enqueue_style(
'wp-mail-smtp-admin-notifications',
wp_mail_smtp()->assets_url . '/css/admin-notifications.min.css',
[],
WPMS_PLUGIN_VER
);
wp_enqueue_script(
'wp-mail-smtp-admin-notifications',
wp_mail_smtp()->assets_url . '/js/smtp-notifications' . WP::asset_min() . '.js',
[ 'jquery' ],
WPMS_PLUGIN_VER,
true
);
}
/**
* Output notifications.
*
* @since 2.3.0
*/
public function output() { // phpcs:ignore Generic.Metrics.NestingLevel.MaxExceeded
$notifications = $this->get();
if ( empty( $notifications ) ) {
return;
}
$notifications_html = '';
$current_class = ' current';
$content_allowed_tags = [
'em' => [],
'i' => [],
'strong' => [],
'span' => [
'style' => [],
],
'a' => [
'href' => [],
'target' => [],
'rel' => [],
],
];
foreach ( $notifications as $notification ) {
// Buttons HTML.
$buttons_html = '';
if ( ! empty( $notification['btns'] ) && is_array( $notification['btns'] ) ) {
foreach ( $notification['btns'] as $btn_type => $btn ) {
if ( empty( $btn['text'] ) ) {
continue;
}
$buttons_html .= sprintf(
'<a href="%1$s" class="button button-%2$s"%3$s>%4$s</a>',
! empty( $btn['url'] ) ? esc_url( $btn['url'] ) : '',
$btn_type === 'main' ? 'primary' : 'secondary',
! empty( $btn['target'] ) && $btn['target'] === '_blank' ? ' target="_blank" rel="noopener noreferrer"' : '',
sanitize_text_field( $btn['text'] )
);
}
$buttons_html = ! empty( $buttons_html ) ? '<div class="buttons">' . $buttons_html . '</div>' : '';
}
// Notification HTML.
$notifications_html .= sprintf(
'<div class="message%5$s" data-message-id="%4$s">
<h3 class="title">%1$s</h3>
<p class="content">%2$s</p>
%3$s
</div>',
! empty( $notification['title'] ) ? sanitize_text_field( $notification['title'] ) : '',
! empty( $notification['content'] ) ? wp_kses( $notification['content'], $content_allowed_tags ) : '',
$buttons_html,
! empty( $notification['id'] ) ? esc_attr( sanitize_text_field( $notification['id'] ) ) : 0,
$current_class
);
// Only first notification is current.
$current_class = '';
}
?>
<div id="wp-mail-smtp-notifications">
<div class="bell">
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="48" viewBox="0 0 42 48"><defs><style>.a{fill:#777;}.b{fill:#ca4a1f;}</style></defs><path class="a" d="M23-79a6.005,6.005,0,0,1-6-6h10.06a12.066,12.066,0,0,0,1.791,1.308,6.021,6.021,0,0,1-2.077,3.352A6.008,6.008,0,0,1,23-79Zm1.605-9H5.009a2.955,2.955,0,0,1-2.173-.923A3.088,3.088,0,0,1,2-91a2.919,2.919,0,0,1,.807-2.036c.111-.12.229-.243.351-.371a14.936,14.936,0,0,0,3.126-4.409A23.283,23.283,0,0,0,8.007-107.5a14.846,14.846,0,0,1,.906-5.145,14.5,14.5,0,0,1,2.509-4.324A15.279,15.279,0,0,1,20-122.046V-124a3,3,0,0,1,3-3,3,3,0,0,1,3,3v1.954a15.28,15.28,0,0,1,8.58,5.078,14.5,14.5,0,0,1,2.509,4.324,14.846,14.846,0,0,1,.906,5.145c0,.645.016,1.281.047,1.888A12.036,12.036,0,0,0,35-106a11.921,11.921,0,0,0-8.485,3.515A11.923,11.923,0,0,0,23-94a12,12,0,0,0,1.6,6Z" transform="translate(-2 127)"/><circle class="b" cx="9" cy="9" r="9" transform="translate(24 24)"/></svg>
</div>
<a class="dismiss" title="<?php echo esc_attr__( 'Dismiss this message', 'wp-mail-smtp' ); ?>"><span class="dashicons dashicons-dismiss"></span></a>
<div class="navigation">
<a class="prev disabled" title="<?php echo esc_attr__( 'Previous message', 'wp-mail-smtp' ); ?>"><span class="dashicons dashicons-arrow-left-alt2"></span></a>
<a class="next disabled" title="<?php echo esc_attr__( 'Next message', 'wp-mail-smtp' ); ?>"><span class="dashicons dashicons-arrow-right-alt2"></span></a>
</div>
<div class="messages">
<?php echo $notifications_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
</div>
<?php
}
/**
* Dismiss notification via AJAX.
*
* @since 2.3.0
*/
public function dismiss() {
// Run a security check.
check_ajax_referer( 'wp-mail-smtp-admin', 'nonce' );
// Check for access and required param.
if ( ! current_user_can( 'manage_options' ) || empty( $_POST['id'] ) ) {
wp_send_json_error();
}
$id = sanitize_text_field( wp_unslash( $_POST['id'] ) );
$option = $this->get_option();
$type = is_numeric( $id ) ? 'feed' : 'events';
$option['dismissed'][] = $id;
$option['dismissed'] = array_unique( $option['dismissed'] );
// Remove notification.
if ( is_array( $option[ $type ] ) && ! empty( $option[ $type ] ) ) {
foreach ( $option[ $type ] as $key => $notification ) {
if ( $notification['id'] == $id ) { // phpcs:ignore WordPress.PHP.StrictComparisons
unset( $option[ $type ][ $key ] );
break;
}
}
}
update_option( self::OPTION_KEY, $option );
wp_send_json_success();
}
}

View File

@ -142,6 +142,8 @@ class About extends PageAbstract {
<?php echo \esc_html( $this->get_label( $this->get_current_tab() ) ); ?> <?php echo \esc_html( $this->get_label( $this->get_current_tab() ) ); ?>
</h1> </h1>
<?php do_action( 'wp_mail_smtp_admin_pages_before_content' ); ?>
<?php <?php
$callback = 'display_' . $this->get_current_tab(); $callback = 'display_' . $this->get_current_tab();

View File

@ -114,7 +114,7 @@ class ControlTab extends PageAbstract {
</div> </div>
<div class="wp-mail-smtp-page-upsell-button"> <div class="wp-mail-smtp-page-upsell-button">
<a href="https://wpmailsmtp.com/lite-upgrade/?discount=LITEUPGRADE&amp;utm_source=WordPress&amp;utm_medium=logs&amp;utm_campaign=liteplugin" <a href="<?php echo esc_url( add_query_arg( 'discount', 'LITEUPGRADE', wp_mail_smtp()->get_upgrade_link( [ 'medium' => 'logs', 'content' => '' ] ) ) ); // phpcs:ignore ?>"
class="wp-mail-smtp-btn wp-mail-smtp-btn-lg wp-mail-smtp-btn-orange" target="_blank" rel="noopener noreferrer"> class="wp-mail-smtp-btn wp-mail-smtp-btn-lg wp-mail-smtp-btn-orange" target="_blank" rel="noopener noreferrer">
<?php esc_html_e( 'Upgrade to WP Mail SMTP Pro', 'wp-mail-smtp' ); ?> <?php esc_html_e( 'Upgrade to WP Mail SMTP Pro', 'wp-mail-smtp' ); ?>
</a> </a>

View File

@ -63,7 +63,8 @@ class LogsTab extends PageAbstract {
</div> </div>
<div class="wp-mail-smtp-page-upsell-button"> <div class="wp-mail-smtp-page-upsell-button">
<a href="https://wpmailsmtp.com/lite-upgrade/?discount=LITEUPGRADE&amp;utm_source=WordPress&amp;utm_medium=logs&amp;utm_campaign=liteplugin" class="wp-mail-smtp-btn wp-mail-smtp-btn-lg wp-mail-smtp-btn-orange wp-mail-smtp-upgrade-modal" target="_blank" rel="noopener noreferrer"> <a href="<?php echo esc_url( add_query_arg( 'discount', 'LITEUPGRADE', wp_mail_smtp()->get_upgrade_link( [ 'medium' => 'logs', 'content' => '' ] ) ) ); // phpcs:ignore ?>"
class="wp-mail-smtp-btn wp-mail-smtp-btn-lg wp-mail-smtp-btn-orange wp-mail-smtp-upgrade-modal" target="_blank" rel="noopener noreferrer">
<?php esc_html_e( 'Upgrade to WP Mail SMTP Pro', 'wp-mail-smtp' ); ?> <?php esc_html_e( 'Upgrade to WP Mail SMTP Pro', 'wp-mail-smtp' ); ?>
</a> </a>
</div> </div>

View File

@ -4,6 +4,7 @@ namespace WPMailSMTP\Admin\Pages;
use WPMailSMTP\Admin\PageAbstract; use WPMailSMTP\Admin\PageAbstract;
use WPMailSMTP\Options; use WPMailSMTP\Options;
use WPMailSMTP\UsageTracking\UsageTracking;
use WPMailSMTP\WP; use WPMailSMTP\WP;
/** /**
@ -190,6 +191,25 @@ class MiscTab extends PageAbstract {
</div> </div>
</div> </div>
<?php if ( apply_filters( 'wp_mail_smtp_admin_pages_misc_tab_show_usage_tracking_setting', true ) ) : ?>
<!-- Usage Tracking -->
<div id="wp-mail-smtp-setting-row-usage-tracking" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-usage-tracking">
<?php esc_html_e( 'Allow Usage Tracking', 'wp-mail-smtp' ); ?>
</label>
</div>
<div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[general][<?php echo esc_attr( UsageTracking::SETTINGS_SLUG ); ?>]" type="checkbox"
value="true" <?php checked( true, $options->get( 'general', UsageTracking::SETTINGS_SLUG ) ); ?>
id="wp-mail-smtp-setting-usage-tracking">
<label for="wp-mail-smtp-setting-usage-tracking">
<?php esc_html_e( 'By allowing us to track usage data we can better help you because we know with which WordPress configurations, themes and plugins we should test.', 'wp-mail-smtp' ); ?>
</label>
</div>
</div>
<?php endif; ?>
<?php $this->display_save_btn(); ?> <?php $this->display_save_btn(); ?>
</form> </form>
@ -224,6 +244,9 @@ class MiscTab extends PageAbstract {
if ( empty( $data['general']['uninstall'] ) ) { if ( empty( $data['general']['uninstall'] ) ) {
$data['general']['uninstall'] = false; $data['general']['uninstall'] = false;
} }
if ( empty( $data['general'][ UsageTracking::SETTINGS_SLUG ] ) ) {
$data['general'][ UsageTracking::SETTINGS_SLUG ] = false;
}
$to_save = Options::array_merge_recursive( $options->get_all(), $data ); $to_save = Options::array_merge_recursive( $options->get_all(), $data );

View File

@ -52,8 +52,14 @@ class SettingsTab extends PageAbstract {
$options = new Options(); $options = new Options();
$mailer = $options->get( 'mail', 'mailer' ); $mailer = $options->get( 'mail', 'mailer' );
$disabled_email = 'gmail' === $mailer || 'outlook' === $mailer ? 'disabled' : ''; $disabled_email = in_array( $mailer, [ 'gmail', 'outlook', 'zoho' ], true ) ? 'disabled' : '';
$disabled_name = 'outlook' === $mailer ? 'disabled' : ''; $disabled_name = 'outlook' === $mailer ? 'disabled' : '';
if ( empty( $mailer ) ) {
$mailer = 'mail';
}
$mailer_supported_settings = wp_mail_smtp()->get_providers()->get_options( $mailer )->get_supports();
?> ?>
<form method="POST" action="" autocomplete="off"> <form method="POST" action="" autocomplete="off">
@ -95,76 +101,79 @@ class SettingsTab extends PageAbstract {
<label for="wp-mail-smtp-setting-from_email"><?php esc_html_e( 'From Email', 'wp-mail-smtp' ); ?></label> <label for="wp-mail-smtp-setting-from_email"><?php esc_html_e( 'From Email', 'wp-mail-smtp' ); ?></label>
</div> </div>
<div class="wp-mail-smtp-setting-field"> <div class="wp-mail-smtp-setting-field">
<?php if ( 'gmail' !== $mailer ) : ?> <div class="js-wp-mail-smtp-setting-from_email" style="display: <?php echo empty( $mailer_supported_settings['from_email'] ) ? 'none' : 'block'; ?>;">
<input name="wp-mail-smtp[mail][from_email]" type="email" <?php if ( 'gmail' !== $mailer ) : ?>
value="<?php echo esc_attr( $options->get( 'mail', 'from_email' ) ); ?>" <input name="wp-mail-smtp[mail][from_email]" type="email"
<?php echo $options->is_const_defined( 'mail', 'from_email' ) || ! empty( $disabled_email ) ? 'disabled' : ''; ?> value="<?php echo esc_attr( $options->get( 'mail', 'from_email' ) ); ?>"
id="wp-mail-smtp-setting-from_email" spellcheck="false" <?php echo $options->is_const_defined( 'mail', 'from_email' ) || ! empty( $disabled_email ) ? 'disabled' : ''; ?>
placeholder="<?php echo esc_attr( wp_mail_smtp()->get_processor()->get_default_email() ); ?>"> id="wp-mail-smtp-setting-from_email" spellcheck="false"
<?php else : ?> placeholder="<?php echo esc_attr( wp_mail_smtp()->get_processor()->get_default_email() ); ?>">
<?php
// Gmail mailer From Email selector.
$gmail_auth = new Auth();
$gmail_aliases = $gmail_auth->is_clients_saved() ? $gmail_auth->get_user_possible_send_from_addresses() : [];
?>
<?php if ( empty( $gmail_aliases ) ) : ?>
<select name="wp-mail-smtp[mail][from_email]" id="wp-mail-smtp-setting-from_email" disabled>
<option value=""><?php esc_html_e( 'Please first authorize the Gmail mailer below', 'wp-mail-smtp' ); ?></option>
</select>
<?php else : ?> <?php else : ?>
<select name="wp-mail-smtp[mail][from_email]" id="wp-mail-smtp-setting-from_email"> <?php
<?php foreach ( $gmail_aliases as $gmail_email_address ) : ?> // Gmail mailer From Email selector.
<option value="<?php echo esc_attr( $gmail_email_address ); ?>" <?php selected( $options->get( 'mail', 'from_email' ), $gmail_email_address ); ?>><?php echo esc_html( $gmail_email_address ); ?></option> $gmail_auth = new Auth();
<?php endforeach; ?> $gmail_aliases = $gmail_auth->is_clients_saved() ? $gmail_auth->get_user_possible_send_from_addresses() : [];
</select> ?>
<?php if ( empty( $gmail_aliases ) ) : ?>
<select name="wp-mail-smtp[mail][from_email]" id="wp-mail-smtp-setting-from_email" disabled>
<option value=""><?php esc_html_e( 'Please first authorize the Gmail mailer below', 'wp-mail-smtp' ); ?></option>
</select>
<?php else : ?>
<select name="wp-mail-smtp[mail][from_email]" id="wp-mail-smtp-setting-from_email">
<?php foreach ( $gmail_aliases as $gmail_email_address ) : ?>
<option value="<?php echo esc_attr( $gmail_email_address ); ?>" <?php selected( $options->get( 'mail', 'from_email' ), $gmail_email_address ); ?>><?php echo esc_html( $gmail_email_address ); ?></option>
<?php endforeach; ?>
</select>
<?php endif; ?>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php if ( empty( $disabled_email ) ) : ?>
<p class="desc">
<?php esc_html_e( 'The email address which emails are sent from.', 'wp-mail-smtp' ); ?><br/>
<?php esc_html_e( 'If you\'re using an email provider (Yahoo, Outlook.com, etc) this should be your email address for that account.', 'wp-mail-smtp' ); ?>
</p>
<p class="desc">
<?php esc_html_e( 'Please note that other plugins can change this, to prevent this use the setting below.', 'wp-mail-smtp' ); ?>
</p>
<?php endif; ?>
</div>
<?php if ( empty( $disabled_email ) ) : ?> <hr class="wp-mail-smtp-setting-mid-row-sep" style="display: <?php echo ( ! empty( $mailer_supported_settings['from_email'] ) && ! empty( $mailer_supported_settings['from_email_force'] ) ) ? 'block' : 'none'; ?>;">
<p class="desc">
<?php esc_html_e( 'The email address which emails are sent from.', 'wp-mail-smtp' ); ?><br/>
<?php esc_html_e( 'If you\'re using an email provider (Yahoo, Outlook.com, etc) this should be your email address for that account.', 'wp-mail-smtp' ); ?>
</p>
<p class="desc">
<?php esc_html_e( 'Please note that other plugins can change this, to prevent this use the setting below.', 'wp-mail-smtp' ); ?>
</p>
<?php endif; ?>
<hr class="wp-mail-smtp-setting-mid-row-sep"> <div class="js-wp-mail-smtp-setting-from_email_force" style="display: <?php echo empty( $mailer_supported_settings['from_email_force'] ) ? 'none' : 'block'; ?>;">
<?php if ( 'gmail' !== $mailer ) : ?>
<input name="wp-mail-smtp[mail][from_email_force]" type="checkbox"
value="true" <?php checked( true, (bool) $options->get( 'mail', 'from_email_force' ) ); ?>
<?php echo $options->is_const_defined( 'mail', 'from_email_force' ) || ! empty( $disabled_email ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-from_email_force">
<?php else : ?>
<input name="wp-mail-smtp[mail][from_email_force]" type="checkbox"
value="true" checked="checked" disabled
id="wp-mail-smtp-setting-from_email_force">
<?php endif; ?>
<?php if ( 'gmail' !== $mailer ) : ?> <label for="wp-mail-smtp-setting-from_email_force">
<input name="wp-mail-smtp[mail][from_email_force]" type="checkbox" <?php esc_html_e( 'Force From Email', 'wp-mail-smtp' ); ?>
value="true" <?php checked( true, (bool) $options->get( 'mail', 'from_email_force' ) ); ?> </label>
<?php echo $options->is_const_defined( 'mail', 'from_email_force' ) || ! empty( $disabled_email ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-from_email_force">
<?php else : ?>
<input name="wp-mail-smtp[mail][from_email_force]" type="checkbox"
value="true" checked="checked" disabled
id="wp-mail-smtp-setting-from_email_force">
<?php endif; ?>
<label for="wp-mail-smtp-setting-from_email_force">
<?php esc_html_e( 'Force From Email', 'wp-mail-smtp' ); ?>
</label>
<?php if ( ! empty( $disabled_email ) ) : ?>
<p class="desc">
<?php
if ( 'gmail' !== $mailer ) :
esc_html_e( 'Current provider will automatically force From Email to be the email address that you use to set up the connection below.', 'wp-mail-smtp' );
else :
esc_html_e( 'Gmail mailer will automatically force From Email to be the email address that you selected above.', 'wp-mail-smtp' );
endif;
?>
</p>
<?php else : ?>
<p class="desc">
<?php esc_html_e( 'If checked, the From Email setting above will be used for all emails, ignoring values set by other plugins.', 'wp-mail-smtp' ); ?>
</p>
<?php endif; ?>
<?php if ( ! empty( $disabled_email ) ) : ?>
<p class="desc">
<?php
if ( 'gmail' !== $mailer ) :
esc_html_e( 'Current provider will automatically force From Email to be the email address that you use to set up the connection below.', 'wp-mail-smtp' );
else :
esc_html_e( 'Gmail mailer will automatically force From Email to be the email address that you selected above.', 'wp-mail-smtp' );
endif;
?>
</p>
<?php else : ?>
<p class="desc">
<?php esc_html_e( 'If checked, the From Email setting above will be used for all emails, ignoring values set by other plugins.', 'wp-mail-smtp' ); ?>
</p>
<?php endif; ?>
</div>
</div> </div>
</div> </div>
@ -174,43 +183,47 @@ class SettingsTab extends PageAbstract {
<label for="wp-mail-smtp-setting-from_name"><?php esc_html_e( 'From Name', 'wp-mail-smtp' ); ?></label> <label for="wp-mail-smtp-setting-from_name"><?php esc_html_e( 'From Name', 'wp-mail-smtp' ); ?></label>
</div> </div>
<div class="wp-mail-smtp-setting-field"> <div class="wp-mail-smtp-setting-field">
<input name="wp-mail-smtp[mail][from_name]" type="text" <div class="js-wp-mail-smtp-setting-from_name" style="display: <?php echo empty( $mailer_supported_settings['from_name'] ) ? 'none' : 'block'; ?>;">
value="<?php echo esc_attr( $options->get( 'mail', 'from_name' ) ); ?>" <input name="wp-mail-smtp[mail][from_name]" type="text"
<?php echo $options->is_const_defined( 'mail', 'from_name' ) || ! empty( $disabled_name ) ? 'disabled' : ''; ?> value="<?php echo esc_attr( $options->get( 'mail', 'from_name' ) ); ?>"
id="wp-mail-smtp-setting-from_name" spellcheck="false" <?php echo $options->is_const_defined( 'mail', 'from_name' ) || ! empty( $disabled_name ) ? 'disabled' : ''; ?>
placeholder="<?php echo esc_attr( wp_mail_smtp()->get_processor()->get_default_name() ); ?>"> id="wp-mail-smtp-setting-from_name" spellcheck="false"
placeholder="<?php echo esc_attr( wp_mail_smtp()->get_processor()->get_default_name() ); ?>">
<?php if ( empty( $disabled_name ) ) : ?> <?php if ( empty( $disabled_name ) ) : ?>
<p class="desc"> <p class="desc">
<?php esc_html_e( 'The name which emails are sent from.', 'wp-mail-smtp' ); ?> <?php esc_html_e( 'The name which emails are sent from.', 'wp-mail-smtp' ); ?>
</p> </p>
<?php endif; ?> <?php endif; ?>
</div>
<hr class="wp-mail-smtp-setting-mid-row-sep"> <hr class="wp-mail-smtp-setting-mid-row-sep" style="display: <?php echo ( ! empty( $mailer_supported_settings['from_name'] ) && ! empty( $mailer_supported_settings['from_name_force'] ) ) ? 'block' : 'none'; ?>;">
<input name="wp-mail-smtp[mail][from_name_force]" type="checkbox" <div class="js-wp-mail-smtp-setting-from_name_force" style="display: <?php echo empty( $mailer_supported_settings['from_name_force'] ) ? 'none' : 'block'; ?>;">
value="true" <?php checked( true, (bool) $options->get( 'mail', 'from_name_force' ) ); ?> <input name="wp-mail-smtp[mail][from_name_force]" type="checkbox"
<?php echo $options->is_const_defined( 'mail', 'from_name_force' ) || ! empty( $disabled_name ) ? 'disabled' : ''; ?> value="true" <?php checked( true, (bool) $options->get( 'mail', 'from_name_force' ) ); ?>
id="wp-mail-smtp-setting-from_name_force"> <?php echo $options->is_const_defined( 'mail', 'from_name_force' ) || ! empty( $disabled_name ) ? 'disabled' : ''; ?>
id="wp-mail-smtp-setting-from_name_force">
<label for="wp-mail-smtp-setting-from_name_force"> <label for="wp-mail-smtp-setting-from_name_force">
<?php esc_html_e( 'Force From Name', 'wp-mail-smtp' ); ?> <?php esc_html_e( 'Force From Name', 'wp-mail-smtp' ); ?>
</label> </label>
<?php if ( ! empty( $disabled_name ) ) : ?> <?php if ( ! empty( $disabled_name ) ) : ?>
<p class="desc"> <p class="desc">
<?php esc_html_e( 'Current provider doesn\'t support setting and forcing From Name. Emails will be sent on behalf of the account name used to setup the connection below.', 'wp-mail-smtp' ); ?> <?php esc_html_e( 'Current provider doesn\'t support setting and forcing From Name. Emails will be sent on behalf of the account name used to setup the connection below.', 'wp-mail-smtp' ); ?>
</p> </p>
<?php else : ?> <?php else : ?>
<p class="desc"> <p class="desc">
<?php esc_html_e( 'If checked, the From Name setting above will be used for all emails, ignoring values set by other plugins.', 'wp-mail-smtp' ); ?> <?php esc_html_e( 'If checked, the From Name setting above will be used for all emails, ignoring values set by other plugins.', 'wp-mail-smtp' ); ?>
</p> </p>
<?php endif; ?> <?php endif; ?>
</div>
</div> </div>
</div> </div>
<!-- Return Path --> <!-- Return Path -->
<div id="wp-mail-smtp-setting-row-return_path" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear"> <div id="wp-mail-smtp-setting-row-return_path" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear js-wp-mail-smtp-setting-return_path" style="display: <?php echo empty( $mailer_supported_settings['return_path'] ) ? 'none' : 'block'; ?>;">
<div class="wp-mail-smtp-setting-label"> <div class="wp-mail-smtp-setting-label">
<label for="wp-mail-smtp-setting-return_path"><?php esc_html_e( 'Return Path', 'wp-mail-smtp' ); ?></label> <label for="wp-mail-smtp-setting-return_path"><?php esc_html_e( 'Return Path', 'wp-mail-smtp' ); ?></label>
</div> </div>
@ -250,7 +263,8 @@ class SettingsTab extends PageAbstract {
<div class="wp-mail-smtp-mailer-text"> <div class="wp-mail-smtp-mailer-text">
<?php if ( $provider->is_disabled() ) : ?> <?php if ( $provider->is_disabled() ) : ?>
<input type="radio" name="wp-mail-smtp[mail][mailer]" disabled class="educate" <input type="radio" name="wp-mail-smtp[mail][mailer]" disabled
class="js-wp-mail-smtp-setting-mailer-radio-input educate"
id="wp-mail-smtp-setting-mailer-<?php echo esc_attr( $provider->get_slug() ); ?>" id="wp-mail-smtp-setting-mailer-<?php echo esc_attr( $provider->get_slug() ); ?>"
value="<?php echo esc_attr( $provider->get_slug() ); ?>" value="<?php echo esc_attr( $provider->get_slug() ); ?>"
/> />
@ -258,9 +272,9 @@ class SettingsTab extends PageAbstract {
<input id="wp-mail-smtp-setting-mailer-<?php echo esc_attr( $provider->get_slug() ); ?>" <input id="wp-mail-smtp-setting-mailer-<?php echo esc_attr( $provider->get_slug() ); ?>"
type="radio" name="wp-mail-smtp[mail][mailer]" type="radio" name="wp-mail-smtp[mail][mailer]"
value="<?php echo esc_attr( $provider->get_slug() ); ?>" value="<?php echo esc_attr( $provider->get_slug() ); ?>"
class="js-wp-mail-smtp-setting-mailer-radio-input<?php echo $provider->is_disabled() ? ' educate' : ''; ?>"
<?php checked( $provider->get_slug(), $mailer ); ?> <?php checked( $provider->get_slug(), $mailer ); ?>
<?php echo $options->is_const_defined( 'mail', 'mailer' ) || $provider->is_disabled() ? 'disabled' : ''; ?> <?php echo $options->is_const_defined( 'mail', 'mailer' ) || $provider->is_disabled() ? 'disabled' : ''; ?>
<?php echo $provider->is_disabled() ? 'class="educate"' : ''; ?>
/> />
<?php endif; ?> <?php endif; ?>
<label for="wp-mail-smtp-setting-mailer-<?php echo esc_attr( $provider->get_slug() ); ?>"> <label for="wp-mail-smtp-setting-mailer-<?php echo esc_attr( $provider->get_slug() ); ?>">

View File

@ -270,25 +270,30 @@ class PluginsInstallUpgrader extends \Plugin_Upgrader {
* Download a package. * Download a package.
* *
* @since 2.8.0 * @since 2.8.0
* @since 5.5.0 Added the `$hook_extra` parameter.
* *
* @param string $package The URI of the package. If this is the full path to an * @param string $package The URI of the package. If this is the full path to an
* existing local file, it will be returned untouched. * existing local file, it will be returned untouched.
* @param bool $check_signatures Whether to validate file signatures. Default false. * @param bool $check_signatures Whether to validate file signatures. Default false.
* @param array $hook_extra Extra arguments to pass to the filter hooks. Default empty array.
*
* @return string|WP_Error The full path to the downloaded package file, or a WP_Error object. * @return string|WP_Error The full path to the downloaded package file, or a WP_Error object.
*/ */
public function download_package( $package, $check_signatures = false ) { public function download_package( $package, $check_signatures = false, $hook_extra = array() ) {
/** /**
* Filters whether to return the package. * Filters whether to return the package.
* *
* @since 3.7.0 * @since 3.7.0
* @since 5.5.0 Added the `$hook_extra` parameter.
* *
* @param bool $reply Whether to bail without returning the package. * @param bool $reply Whether to bail without returning the package.
* Default false. * Default false.
* @param string $package The package file name. * @param string $package The package file name.
* @param WP_Upgrader $this The WP_Upgrader instance. * @param WP_Upgrader $this The WP_Upgrader instance.
* @param array $hook_extra Extra arguments passed to hooked filters.
*/ */
$reply = apply_filters( 'upgrader_pre_download', false, $package, $this ); $reply = apply_filters( 'upgrader_pre_download', false, $package, $this, $hook_extra );
if ( false !== $reply ) { if ( false !== $reply ) {
return $reply; return $reply;
} }

View File

@ -88,8 +88,8 @@ class Review {
// Get the currently selected mailer. // Get the currently selected mailer.
$mailer = Options::init()->get( 'mail', 'mailer' ); $mailer = Options::init()->get( 'mail', 'mailer' );
// Skip if the default mailer is selected. // Skip if no or the default mailer is selected.
if ( $mailer === 'mail' ) { if ( empty( $mailer ) || $mailer === 'mail' ) {
return; return;
} }

View File

@ -2,6 +2,10 @@
namespace WPMailSMTP; namespace WPMailSMTP;
use WPMailSMTP\Admin\AdminBarMenu;
use WPMailSMTP\Admin\Notifications;
use WPMailSMTP\UsageTracking\UsageTracking;
/** /**
* Class Core to handle all plugin initialization. * Class Core to handle all plugin initialization.
* *
@ -105,24 +109,27 @@ class Core {
} }
// Action Scheduler requires a special early loading procedure. // Action Scheduler requires a special early loading procedure.
add_action( 'plugins_loaded', array( $this, 'load_action_scheduler' ), - 10 ); add_action( 'plugins_loaded', [ $this, 'load_action_scheduler' ], - 10 );
// Activation hook. // Activation hook.
register_activation_hook( WPMS_PLUGIN_FILE, array( $this, 'activate' ) ); register_activation_hook( WPMS_PLUGIN_FILE, [ $this, 'activate' ] );
// Redefine PHPMailer. // Redefine PHPMailer.
add_action( 'plugins_loaded', array( $this, 'get_processor' ) ); add_action( 'plugins_loaded', [ $this, 'get_processor' ] );
add_action( 'plugins_loaded', array( $this, 'replace_phpmailer' ) ); add_action( 'plugins_loaded', [ $this, 'replace_phpmailer' ] );
// Various notifications. // Various notifications.
add_action( 'admin_init', array( $this, 'init_notifications' ) ); add_action( 'admin_init', [ $this, 'init_notifications' ] );
add_action( 'init', array( $this, 'init' ) ); add_action( 'init', [ $this, 'init' ] );
// Initialize Action Scheduler tasks. // Initialize Action Scheduler tasks.
add_action( 'init', array( $this, 'get_tasks' ), 5 ); add_action( 'init', [ $this, 'get_tasks' ], 5 );
add_action( 'plugins_loaded', array( $this, 'get_pro' ) ); add_action( 'plugins_loaded', [ $this, 'get_pro' ] );
add_action( 'plugins_loaded', [ $this, 'get_usage_tracking' ] );
add_action( 'plugins_loaded', [ $this, 'get_admin_bar_menu' ] );
add_action( 'plugins_loaded', [ $this, 'get_notifications' ] );
} }
/** /**
@ -264,6 +271,10 @@ class Core {
if ( ! isset( $processor ) ) { if ( ! isset( $processor ) ) {
$processor = apply_filters( 'wp_mail_smtp_core_get_processor', new Processor() ); $processor = apply_filters( 'wp_mail_smtp_core_get_processor', new Processor() );
if ( method_exists( $processor, 'hooks' ) ) {
$processor->hooks();
}
} }
return $processor; return $processor;
@ -469,7 +480,20 @@ class Core {
} }
if ( wp_mail_smtp()->get_admin()->is_error_delivery_notice_enabled() ) { if ( wp_mail_smtp()->get_admin()->is_error_delivery_notice_enabled() ) {
$notice = Debug::get_last(); $screen = get_current_screen();
// Skip the error notice if not on plugin page.
if (
is_object( $screen ) &&
strpos( $screen->id, 'page_wp-mail-smtp' ) === false
) {
return;
}
$notice = apply_filters(
'wp_mail_smtp_core_display_general_notices_email_delivery_error_notice',
Debug::get_last()
);
if ( ! empty( $notice ) ) { if ( ! empty( $notice ) ) {
?> ?>
@ -618,6 +642,19 @@ class Core {
* @since 2.1.0 * @since 2.1.0
*/ */
add_option( 'wp_mail_smtp_activated_time', time(), '', false ); add_option( 'wp_mail_smtp_activated_time', time(), '', false );
/**
* Store the timestamp of the first plugin activation by license type.
*
* @since 2.3.0
*/
$license_type = is_readable( $this->plugin_path . '/src/Pro/Pro.php' ) ? 'pro' : 'lite';
$activated = get_option( 'wp_mail_smtp_activated', [] );
if ( empty( $activated[ $license_type ] ) ) {
$activated[ $license_type ] = time();
update_option( 'wp_mail_smtp_activated', $activated );
}
} }
/** /**
@ -703,10 +740,13 @@ class Core {
$content = $utm; $content = $utm;
} }
return apply_filters( $url = 'https://wpmailsmtp.com/lite-upgrade/?utm_source=' . esc_attr( $source ) . '&utm_medium=' . esc_attr( $medium ) . '&utm_campaign=' . esc_attr( $campaign );
'wp_mail_smtp_core_get_upgrade_link',
'https://wpmailsmtp.com/lite-upgrade/?utm_source=' . esc_attr( $source ) . '&utm_medium=' . esc_attr( $medium ) . '&utm_campaign=' . esc_attr( $campaign ) . '&utm_content=' . esc_attr( $content ) if ( ! empty( $content ) ) {
); $url .= '&utm_content=' . esc_attr( $content );
}
return apply_filters( 'wp_mail_smtp_core_get_upgrade_link', $url );
} }
/** /**
@ -841,4 +881,76 @@ class Core {
return $value; return $value;
} }
/**
* Load the plugin admin bar menu and initialize it.
*
* @since 2.3.0
*
* @return AdminBarMenu
*/
public function get_admin_bar_menu() {
static $admin_bar_menu;
if ( ! isset( $admin_bar_menu ) ) {
$admin_bar_menu = apply_filters(
'wp_mail_smtp_core_get_admin_bar_menu',
new AdminBarMenu()
);
if ( method_exists( $admin_bar_menu, 'init' ) ) {
$admin_bar_menu->init();
}
}
return $admin_bar_menu;
}
/**
* Load the plugin usage tracking.
*
* @since 2.3.0
*
* @return UsageTracking
*/
public function get_usage_tracking() {
static $usage_tracking;
if ( ! isset( $usage_tracking ) ) {
$usage_tracking = apply_filters( 'wp_mail_smtp_core_get_usage_tracking', new UsageTracking() );
if ( method_exists( $usage_tracking, 'load' ) ) {
$usage_tracking->load();
}
}
return $usage_tracking;
}
/**
* Load the plugin admin notifications functionality and initializes it.
*
* @since 2.3.0
*
* @return Notifications
*/
public function get_notifications() {
static $notifications;
if ( ! isset( $notifications ) ) {
$notifications = apply_filters(
'wp_mail_smtp_core_get_notifications',
new Notifications()
);
if ( method_exists( $notifications, 'init' ) ) {
$notifications->init();
}
}
return $notifications;
}
} }

View File

@ -2,6 +2,8 @@
namespace WPMailSMTP; namespace WPMailSMTP;
use WPMailSMTP\UsageTracking\UsageTracking;
/** /**
* Class Options to handle all options management. * Class Options to handle all options management.
* WordPress does all the heavy work for caching get_option() data, * WordPress does all the heavy work for caching get_option() data,
@ -51,6 +53,11 @@ class Options {
'client_id', 'client_id',
'client_secret', 'client_secret',
], ],
'zoho' => [
'domain',
'client_id',
'client_secret',
],
'amazonses' => [ 'amazonses' => [
'client_id', 'client_id',
'client_secret', 'client_secret',
@ -463,6 +470,24 @@ class Options {
break; break;
case 'zoho':
switch ( $key ) {
case 'domain':
/** No inspection comment @noinspection PhpUndefinedConstantInspection */
$return = $this->is_const_defined( $group, $key ) ? WPMS_ZOHO_DOMAIN : $value;
break;
case 'client_id':
/** No inspection comment @noinspection PhpUndefinedConstantInspection */
$return = $this->is_const_defined( $group, $key ) ? WPMS_ZOHO_CLIENT_ID : $value;
break;
case 'client_secret':
/** No inspection comment @noinspection PhpUndefinedConstantInspection */
$return = $this->is_const_defined( $group, $key ) ? WPMS_ZOHO_CLIENT_SECRET : $value;
break;
}
break;
case 'amazonses': case 'amazonses':
switch ( $key ) { switch ( $key ) {
case 'client_id': case 'client_id':
@ -689,6 +714,21 @@ class Options {
break; break;
case 'zoho':
switch ( $key ) {
case 'domain':
$return = defined( 'WPMS_ZOHO_DOMAIN' ) && WPMS_ZOHO_DOMAIN;
break;
case 'client_id':
$return = defined( 'WPMS_ZOHO_CLIENT_ID' ) && WPMS_ZOHO_CLIENT_ID;
break;
case 'client_secret':
$return = defined( 'WPMS_ZOHO_CLIENT_SECRET' ) && WPMS_ZOHO_CLIENT_SECRET;
break;
}
break;
case 'amazonses': case 'amazonses':
switch ( $key ) { switch ( $key ) {
case 'client_id': case 'client_id':
@ -828,6 +868,7 @@ class Options {
case 'am_notifications_hidden': case 'am_notifications_hidden':
case 'email_delivery_errors_hidden': case 'email_delivery_errors_hidden':
case 'uninstall': case 'uninstall':
case UsageTracking::SETTINGS_SLUG:
$options[ $group ][ $option_name ] = (bool) $option_value; $options[ $group ][ $option_name ] = (bool) $option_value;
break; break;
} }
@ -841,7 +882,7 @@ class Options {
if ( if (
! empty( $options['mail']['mailer'] ) && ! empty( $options['mail']['mailer'] ) &&
isset( $options[ $options['mail']['mailer'] ] ) && isset( $options[ $options['mail']['mailer'] ] ) &&
in_array( $options['mail']['mailer'], array( 'pepipost', 'pepipostapi', 'smtp', 'sendgrid', 'smtpcom', 'sendinblue', 'mailgun', 'gmail', 'outlook' ), true ) in_array( $options['mail']['mailer'], [ 'pepipost', 'pepipostapi', 'smtp', 'sendgrid', 'smtpcom', 'sendinblue', 'mailgun', 'gmail', 'outlook', 'zoho' ], true )
) { ) {
$mailer = $options['mail']['mailer']; $mailer = $options['mail']['mailer'];
@ -870,16 +911,16 @@ class Options {
break; break;
case 'api_key': // mailgun/sendgrid/sendinblue/pepipostapi/smtpcom. case 'api_key': // mailgun/sendgrid/sendinblue/pepipostapi/smtpcom.
case 'domain': // mailgun. case 'domain': // mailgun/zoho.
case 'client_id': // gmail/outlook/amazonses. case 'client_id': // gmail/outlook/amazonses/zoho.
case 'client_secret': // gmail/outlook/amazonses. case 'client_secret': // gmail/outlook/amazonses/zoho.
case 'auth_code': // gmail/outlook. case 'auth_code': // gmail/outlook.
case 'channel': // smtpcom. case 'channel': // smtpcom.
$options[ $mailer ][ $option_name ] = $this->is_const_defined( $mailer, $option_name ) ? '' : sanitize_text_field( $option_value ); $options[ $mailer ][ $option_name ] = $this->is_const_defined( $mailer, $option_name ) ? '' : sanitize_text_field( $option_value );
break; break;
case 'access_token': // gmail/outlook, array(). case 'access_token': // gmail/outlook/zoho, is an array.
case 'user_details': // outlook, array(). case 'user_details': // outlook/zoho, is an array.
case 'emails_pending': // amazonses, array(). case 'emails_pending': // amazonses, array().
// These options don't support constants. // These options don't support constants.
$options[ $mailer ][ $option_name ] = $option_value; $options[ $mailer ][ $option_name ] = $option_value;
@ -899,6 +940,8 @@ class Options {
// Now we need to re-cache values. // Now we need to re-cache values.
$this->populate_options(); $this->populate_options();
do_action( 'wp_mail_smtp_options_set_after', $options );
} }
/** /**
@ -961,6 +1004,25 @@ class Options {
return apply_filters( 'wp_mail_smtp_options_is_pepipost_active', $this->get( 'mail', 'mailer' ) === 'pepipost' ); return apply_filters( 'wp_mail_smtp_options_is_pepipost_active', $this->get( 'mail', 'mailer' ) === 'pepipost' );
} }
/**
* Check whether the site is using provided mailer or not.
*
* @since 2.3.0
*
* @param string $mailer The mailer slug.
*
* @return bool
*/
public function is_mailer_active( $mailer ) {
$mailer = sanitize_key( $mailer );
return apply_filters(
"wp_mail_smtp_options_is_mailer_active_{$mailer}",
$this->get( 'mail', 'mailer' ) === $mailer
);
}
/** /**
* Check whether the site is using Pepipost/SMTP as a mailer or not. * Check whether the site is using Pepipost/SMTP as a mailer or not.
* *

View File

@ -21,15 +21,6 @@ class Processor {
*/ */
protected $wp_mail_from; protected $wp_mail_from;
/**
* Processor constructor.
*
* @since 1.0.0
*/
public function __construct() {
$this->hooks();
}
/** /**
* Assign all hooks to proper places. * Assign all hooks to proper places.
* *
@ -152,8 +143,8 @@ class Processor {
if ( $mailer === 'gmail' ) { if ( $mailer === 'gmail' ) {
$forced = true; $forced = true;
} elseif ( $mailer === 'outlook' ) { } elseif ( in_array( $mailer, [ 'outlook', 'zoho' ], true ) ) {
$sender = $options->get( 'outlook', 'user_details' ); $sender = $options->get( $mailer, 'user_details' );
$from_email = ! empty( $sender['email'] ) ? $sender['email'] : ''; $from_email = ! empty( $sender['email'] ) ? $sender['email'] : '';
$forced = true; $forced = true;
} }

View File

@ -22,33 +22,41 @@ class Options extends OptionsAbstract {
* Gmail Options constructor. * Gmail Options constructor.
* *
* @since 1.0.0 * @since 1.0.0
* @since 2.3.0 Added supports parameter.
*/ */
public function __construct() { public function __construct() {
parent::__construct( parent::__construct(
array( [
'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/google.svg', 'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/google.svg',
'slug' => self::SLUG, 'slug' => self::SLUG,
'title' => esc_html__( 'Gmail', 'wp-mail-smtp' ), 'title' => esc_html__( 'Gmail', 'wp-mail-smtp' ),
'description' => sprintf( 'description' => sprintf(
wp_kses( /* translators: %s - URL to our Gmail doc. */ wp_kses( /* translators: %s - URL to our Gmail doc. */
__( 'Send emails using your Gmail or G Suite (formerly Google Apps) account, all while keeping your login credentials safe. Other Google SMTP methods require enabling less secure apps in your account and entering your password. However, this integration uses the Google API to improve email delivery issues while keeping your site secure.<br><br>Read our <a href="%s" target="_blank" rel="noopener noreferrer">Gmail documentation</a> to learn how to configure Gmail or G Suite.', 'wp-mail-smtp' ), __( 'Send emails using your Gmail or G Suite (formerly Google Apps) account, all while keeping your login credentials safe. Other Google SMTP methods require enabling less secure apps in your account and entering your password. However, this integration uses the Google API to improve email delivery issues while keeping your site secure.<br><br>Read our <a href="%s" target="_blank" rel="noopener noreferrer">Gmail documentation</a> to learn how to configure Gmail or G Suite.', 'wp-mail-smtp' ),
array( [
'br' => array(), 'br' => [],
'a' => array( 'a' => [
'href' => array(), 'href' => [],
'rel' => array(), 'rel' => [],
'target' => array(), 'target' => [],
), ],
) ]
), ),
'https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/' 'https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/'
), ),
'notices' => array( 'notices' => [
'educational' => esc_html__( 'The Gmail mailer works well for sites that send low numbers of emails. However, Gmail\'s API has rate limitations and a number of additional restrictions that can lead to challenges during setup. If you expect to send a high volume of emails, or if you find that your web host is not compatible with the Gmail API restrictions, then we recommend considering a different mailer option.', 'wp-mail-smtp' ), 'educational' => esc_html__( 'The Gmail mailer works well for sites that send low numbers of emails. However, Gmail\'s API has rate limitations and a number of additional restrictions that can lead to challenges during setup. If you expect to send a high volume of emails, or if you find that your web host is not compatible with the Gmail API restrictions, then we recommend considering a different mailer option.', 'wp-mail-smtp' ),
), ],
'php' => '5.5', 'php' => '5.5',
) 'supports' => [
'from_email' => true,
'from_name' => true,
'return_path' => false,
'from_email_force' => true,
'from_name_force' => true,
],
]
); );
} }
@ -109,7 +117,7 @@ class Options extends OptionsAbstract {
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_redirect"><?php esc_html_e( 'Authorized redirect URI', 'wp-mail-smtp' ); ?></label> <label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_redirect"><?php esc_html_e( 'Authorized redirect URI', 'wp-mail-smtp' ); ?></label>
</div> </div>
<div class="wp-mail-smtp-setting-field"> <div class="wp-mail-smtp-setting-field">
<input type="text" readonly="readonly" <input type="text" readonly="readonly" onfocus="this.select();"
value="<?php echo esc_attr( Auth::get_plugin_auth_url() ); ?>" value="<?php echo esc_attr( Auth::get_plugin_auth_url() ); ?>"
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_redirect" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_redirect"
/> />

View File

@ -32,6 +32,7 @@ class Loader {
'amazonses' => 'WPMailSMTP\Providers\AmazonSES\\', 'amazonses' => 'WPMailSMTP\Providers\AmazonSES\\',
'gmail' => 'WPMailSMTP\Providers\Gmail\\', 'gmail' => 'WPMailSMTP\Providers\Gmail\\',
'outlook' => 'WPMailSMTP\Providers\Outlook\\', 'outlook' => 'WPMailSMTP\Providers\Outlook\\',
'zoho' => 'WPMailSMTP\Providers\Zoho\\',
'smtp' => 'WPMailSMTP\Providers\SMTP\\', 'smtp' => 'WPMailSMTP\Providers\SMTP\\',
'pepipost' => 'WPMailSMTP\Providers\Pepipost\\', 'pepipost' => 'WPMailSMTP\Providers\Pepipost\\',
); );
@ -56,6 +57,10 @@ class Loader {
unset( $this->providers['pepipost'] ); unset( $this->providers['pepipost'] );
} }
if ( ! Options::init()->is_mailer_active( 'pepipostapi' ) ) {
unset( $this->providers['pepipostapi'] );
}
return apply_filters( 'wp_mail_smtp_providers_loader_get_providers', $this->providers ); return apply_filters( 'wp_mail_smtp_providers_loader_get_providers', $this->providers );
} }
@ -200,4 +205,35 @@ class Loader {
return apply_filters( 'wp_mail_smtp_providers_loader_get_entity', $entity, $provider, $request ); return apply_filters( 'wp_mail_smtp_providers_loader_get_entity', $entity, $provider, $request );
} }
/**
* Get supports options for all mailers.
*
* @since 2.3.0
*
* @return array
*/
public function get_supports_all() {
$supports = [];
foreach ( $this->get_providers() as $provider => $path ) {
$option = $this->get_options( $provider );
if ( ! $option instanceof OptionsAbstract ) {
continue;
}
$mailer_slug = $option->get_slug();
$mailer_supports = $option->get_supports();
if ( empty( $mailer_slug ) || empty( $mailer_supports ) ) {
continue;
}
$supports[ $mailer_slug ] = $mailer_supports;
}
return apply_filters( 'wp_mail_smtp_providers_loader_get_supports_all', $supports );
}
} }

View File

@ -54,12 +54,22 @@ abstract class OptionsAbstract implements OptionsInterface {
*/ */
protected $options; protected $options;
/**
* An array with mailer supported setting fields.
*
* @since 2.3.0
*
* @var array
*/
protected $supports;
/** /**
* ProviderAbstract constructor. * ProviderAbstract constructor.
* *
* @since 1.0.0 * @since 1.0.0
* @since 2.3.0 Added supports parameter.
* *
* @param array $params * @param array $params The mailer options parameters.
*/ */
public function __construct( $params ) { public function __construct( $params ) {
@ -120,6 +130,8 @@ abstract class OptionsAbstract implements OptionsInterface {
$this->logo_url = esc_url_raw( $params['logo_url'] ); $this->logo_url = esc_url_raw( $params['logo_url'] );
} }
$this->supports = ( ! empty( $params['supports'] ) ) ? $params['supports'] : $this->get_supports_defaults();
$this->options = new Options(); $this->options = new Options();
} }
@ -474,4 +486,33 @@ abstract class OptionsAbstract implements OptionsInterface {
<?php <?php
} }
/**
* Return the defaults for the mailer supported settings.
*
* @since 2.3.0
*
* @return array
*/
public function get_supports_defaults() {
return [
'from_email' => true,
'from_name' => true,
'return_path' => true,
'from_email_force' => true,
'from_name_force' => true,
];
}
/**
* Get the mailer supported settings.
*
* @since 2.3.0
*
* @return array
*/
public function get_supports() {
return apply_filters( 'wp_mail_smtp_providers_provider_get_supports', $this->supports, $this );
}
} }

View File

@ -1,64 +1,71 @@
<?php <?php
namespace WPMailSMTP\Providers; namespace WPMailSMTP\Providers;
/** /**
* Interface ProviderInterface, shared between all current and future providers. * Interface ProviderInterface, shared between all current and future providers.
* Defines required methods across all providers. * Defines required methods across all providers.
* *
* @since 1.0.0 * @since 1.0.0
*/ */
interface OptionsInterface { interface OptionsInterface {
/** /**
* Get the mailer provider slug. * Get the mailer provider slug.
* *
* @since 1.0.0 * @since 1.0.0
* *
* @return string * @return string
*/ */
public function get_slug(); public function get_slug();
/** /**
* Get the mailer provider title (or name). * Get the mailer provider title (or name).
* *
* @since 1.0.0 * @since 1.0.0
* *
* @return string * @return string
*/ */
public function get_title(); public function get_title();
/** /**
* Get the mailer provider description. * Get the mailer provider description.
* *
* @since 1.0.0 * @since 1.0.0
* *
* @return string * @return string
*/ */
public function get_description(); public function get_description();
/** /**
* Get the mailer provider minimum PHP version. * Get the mailer provider minimum PHP version.
* *
* @since 1.0.0 * @since 1.0.0
* *
* @return string * @return string
*/ */
public function get_php_version(); public function get_php_version();
/** /**
* Get the mailer provider logo URL. * Get the mailer provider logo URL.
* *
* @since 1.0.0 * @since 1.0.0
* *
* @return string * @return string
*/ */
public function get_logo_url(); public function get_logo_url();
/** /**
* Output the mailer provider options. * Output the mailer provider options.
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function display_options(); public function display_options();
}
/**
* Get the mailer supported settings.
*
* @since 2.3.0
*/
public function get_supports();
}

View File

@ -23,19 +23,19 @@ class Options extends OptionsAbstract {
* Options constructor. * Options constructor.
* *
* @since 1.8.0 * @since 1.8.0
* @since 2.3.0 Added 'supports' parameter.
*/ */
public function __construct() { public function __construct() {
$description = sprintf( $description = sprintf(
wp_kses( /* translators: %1$s - URL to pepipost.com site. */ wp_kses( /* translators: %1$s - URL to pepipost.com site. */
__( '<strong><a href="%1$s" target="_blank" rel="noopener noreferrer">Pepipost</a> is a recommended transactional email service.</strong> Every month Pepipost delivers over 8 billion emails from 20,000+ customers. Their mission is to reliably send emails in the most efficient way and at the most disruptive pricing ever. Pepipost provides users 30,000 free emails the first 30 days.', 'wp-mail-smtp' ) . __( '<a href="%1$s" target="_blank" rel="noopener noreferrer">Pepipost</a> is a transactional email service. Every month Pepipost delivers over 8 billion emails from 20,000+ customers. Their mission is to reliably send emails in the most efficient way and at the most disruptive pricing ever. Pepipost provides users 30,000 free emails the first 30 days.', 'wp-mail-smtp' ) .
'<br><br>' . '<br><br>' .
/* translators: %1$s - URL to wpmailsmtp.com doc. */ /* translators: %1$s - URL to wpmailsmtp.com doc. */
__( 'Read our <a href="%2$s" target="_blank" rel="noopener noreferrer">Pepipost documentation</a> to learn how to configure Pepipost and improve your email deliverability.', 'wp-mail-smtp' ), __( 'Read our <a href="%2$s" target="_blank" rel="noopener noreferrer">Pepipost documentation</a> to learn how to configure Pepipost and improve your email deliverability.', 'wp-mail-smtp' ),
array( array(
'br' => true, 'br' => true,
'strong' => true, 'a' => array(
'a' => array(
'href' => true, 'href' => true,
'rel' => true, 'rel' => true,
'target' => true, 'target' => true,
@ -55,14 +55,20 @@ class Options extends OptionsAbstract {
} }
parent::__construct( parent::__construct(
array( [
'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/pepipost.png', 'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/pepipost.png',
'slug' => self::SLUG, 'slug' => self::SLUG,
'title' => esc_html__( 'Pepipost', 'wp-mail-smtp' ), 'title' => esc_html__( 'Pepipost', 'wp-mail-smtp' ),
'description' => $description, 'description' => $description,
'recommended' => true,
'php' => '5.3', 'php' => '5.3',
) 'supports' => [
'from_email' => true,
'from_name' => true,
'return_path' => false,
'from_email_force' => true,
'from_name_force' => true,
],
]
); );
} }

View File

@ -23,6 +23,7 @@ class Options extends OptionsAbstract {
* Options constructor. * Options constructor.
* *
* @since 2.0.0 * @since 2.0.0
* @since 2.3.0 Added supports parameter.
*/ */
public function __construct() { public function __construct() {
@ -61,13 +62,20 @@ class Options extends OptionsAbstract {
} }
parent::__construct( parent::__construct(
array( [
'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/smtp-com.svg', 'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/smtp-com.svg',
'slug' => self::SLUG, 'slug' => self::SLUG,
'title' => esc_html__( 'SMTP.com', 'wp-mail-smtp' ), 'title' => esc_html__( 'SMTP.com', 'wp-mail-smtp' ),
'description' => $description, 'description' => $description,
'recommended' => true, 'recommended' => true,
) 'supports' => [
'from_email' => true,
'from_name' => true,
'return_path' => false,
'from_email_force' => true,
'from_name_force' => true,
],
]
); );
} }

View File

@ -1,96 +1,104 @@
<?php <?php
namespace WPMailSMTP\Providers\Sendgrid; namespace WPMailSMTP\Providers\Sendgrid;
use WPMailSMTP\Providers\OptionsAbstract; use WPMailSMTP\Providers\OptionsAbstract;
/** /**
* Class Option. * Class Option.
* *
* @since 1.0.0 * @since 1.0.0
*/ */
class Options extends OptionsAbstract { class Options extends OptionsAbstract {
/** /**
* Options constructor. * Options constructor.
* *
* @since 1.0.0 * @since 1.0.0
*/ * @since 2.3.0 Added supports parameter.
public function __construct() { */
public function __construct() {
parent::__construct(
array( parent::__construct(
'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/sendgrid.svg', [
'slug' => 'sendgrid', 'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/sendgrid.svg',
'title' => esc_html__( 'SendGrid', 'wp-mail-smtp' ), 'slug' => 'sendgrid',
'description' => sprintf( 'title' => esc_html__( 'SendGrid', 'wp-mail-smtp' ),
wp_kses( 'description' => sprintf(
/* translators: %1$s - opening link tag; %2$s - closing link tag; %3$s - opening link tag; %4$s - closing link tag. */ wp_kses(
__( '%1$sSendGrid%2$s is one of the leading transactional email services, sending over 35 billion emails every month. They provide users 100 free emails per day.<br><br>Read our %3$sSendGrid documentation%4$s to learn how to set up SendGrid and improve your email deliverability.', 'wp-mail-smtp' ), /* translators: %1$s - opening link tag; %2$s - closing link tag; %3$s - opening link tag; %4$s - closing link tag. */
array( __( '%1$sSendGrid%2$s is one of the leading transactional email services, sending over 35 billion emails every month. They provide users 100 free emails per day.<br><br>Read our %3$sSendGrid documentation%4$s to learn how to set up SendGrid and improve your email deliverability.', 'wp-mail-smtp' ),
'br' => array(), [
'a' => array( 'br' => [],
'href' => array(), 'a' => [
'rel' => array(), 'href' => [],
'target' => array(), 'rel' => [],
), 'target' => [],
) ],
), ]
'<a href="https://sendgrid.com" target="_blank" rel="noopener noreferrer">', ),
'</a>', '<a href="https://sendgrid.com" target="_blank" rel="noopener noreferrer">',
'<a href="https://wpmailsmtp.com/docs/how-to-set-up-the-sendgrid-mailer-in-wp-mail-smtp/" target="_blank" rel="noopener noreferrer">', '</a>',
'</a>' '<a href="https://wpmailsmtp.com/docs/how-to-set-up-the-sendgrid-mailer-in-wp-mail-smtp/" target="_blank" rel="noopener noreferrer">',
), '</a>'
) ),
); 'supports' => [
} 'from_email' => true,
'from_name' => true,
/** 'return_path' => false,
* @inheritdoc 'from_email_force' => true,
*/ 'from_name_force' => true,
public function display_options() { ],
?> ]
);
<!-- API Key --> }
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-api_key" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<div class="wp-mail-smtp-setting-label"> /**
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"><?php esc_html_e( 'API Key', 'wp-mail-smtp' ); ?></label> * @inheritdoc
</div> */
<div class="wp-mail-smtp-setting-field"> public function display_options() {
<?php if ( $this->options->is_const_defined( $this->get_slug(), 'api_key' ) ) : ?> ?>
<input type="text" disabled value="****************************************"
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key" <!-- API Key -->
/> <div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-api_key" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
<?php $this->display_const_set_message( 'WPMS_SENDGRID_API_KEY' ); ?> <div class="wp-mail-smtp-setting-label">
<?php else : ?> <label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"><?php esc_html_e( 'API Key', 'wp-mail-smtp' ); ?></label>
<input type="password" spellcheck="false" </div>
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][api_key]" <div class="wp-mail-smtp-setting-field">
value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'api_key' ) ); ?>" <?php if ( $this->options->is_const_defined( $this->get_slug(), 'api_key' ) ) : ?>
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key" <input type="text" disabled value="****************************************"
/> id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
<?php endif; ?> />
<p class="desc"> <?php $this->display_const_set_message( 'WPMS_SENDGRID_API_KEY' ); ?>
<?php <?php else : ?>
printf( <input type="password" spellcheck="false"
/* translators: %s - API key link. */ name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][api_key]"
esc_html__( 'Follow this link to get an API Key from SendGrid: %s.', 'wp-mail-smtp' ), value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'api_key' ) ); ?>"
'<a href="https://app.sendgrid.com/settings/api_keys" target="_blank" rel="noopener noreferrer">' . id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
esc_html__( 'Create API Key', 'wp-mail-smtp' ) . />
'</a>' <?php endif; ?>
); <p class="desc">
?> <?php
<br/> printf(
<?php /* translators: %s - API key link. */
printf( esc_html__( 'Follow this link to get an API Key from SendGrid: %s.', 'wp-mail-smtp' ),
/* translators: %s - SendGrid access level. */ '<a href="https://app.sendgrid.com/settings/api_keys" target="_blank" rel="noopener noreferrer">' .
esc_html__( 'To send emails you will need only a %s access level for this API key.', 'wp-mail-smtp' ), esc_html__( 'Create API Key', 'wp-mail-smtp' ) .
'<code>Mail Send</code>' '</a>'
); );
?> ?>
</p> <br/>
</div> <?php
</div> printf(
/* translators: %s - SendGrid access level. */
<?php esc_html__( 'To send emails you will need only a %s access level for this API key.', 'wp-mail-smtp' ),
} '<code>Mail Send</code>'
} );
?>
</p>
</div>
</div>
<?php
}
}

View File

@ -23,11 +23,12 @@ class Options extends OptionsAbstract {
* Options constructor. * Options constructor.
* *
* @since 1.6.0 * @since 1.6.0
* @since 2.3.0 Added supports parameter.
*/ */
public function __construct() { public function __construct() {
parent::__construct( parent::__construct(
array( [
'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/sendinblue.svg', 'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/sendinblue.svg',
'slug' => self::SLUG, 'slug' => self::SLUG,
'title' => esc_html__( 'Sendinblue', 'wp-mail-smtp' ), 'title' => esc_html__( 'Sendinblue', 'wp-mail-smtp' ),
@ -38,19 +39,26 @@ class Options extends OptionsAbstract {
'<br><br>' . '<br><br>' .
/* translators: %2$s - URL to wpmailsmtp.com doc. */ /* translators: %2$s - URL to wpmailsmtp.com doc. */
__( 'Read our <a href="%2$s" target="_blank" rel="noopener noreferrer">Sendinblue documentation</a> to learn how to configure Sendinblue and improve your email deliverability.', 'wp-mail-smtp' ), __( 'Read our <a href="%2$s" target="_blank" rel="noopener noreferrer">Sendinblue documentation</a> to learn how to configure Sendinblue and improve your email deliverability.', 'wp-mail-smtp' ),
array( [
'br' => true, 'br' => true,
'a' => array( 'a' => [
'href' => true, 'href' => true,
'rel' => true, 'rel' => true,
'target' => true, 'target' => true,
), ],
) ]
), ),
'https://wpmailsmtp.com/go/sendinblue/', 'https://wpmailsmtp.com/go/sendinblue/',
'https://wpmailsmtp.com/docs/how-to-set-up-the-sendinblue-mailer-in-wp-mail-smtp' 'https://wpmailsmtp.com/docs/how-to-set-up-the-sendinblue-mailer-in-wp-mail-smtp'
), ),
) 'supports' => [
'from_email' => true,
'from_name' => true,
'return_path' => false,
'from_email_force' => true,
'from_name_force' => true,
],
]
); );
} }

View File

@ -0,0 +1,46 @@
<?php
namespace WPMailSMTP\Providers\Zoho;
use WPMailSMTP\Providers\OptionsAbstract;
/**
* Class Options.
*
* @since 2.3.0
*/
class Options extends OptionsAbstract {
/**
* Zoho Options constructor.
*
* @since 2.3.0
*/
public function __construct() {
parent::__construct(
array(
'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/zoho.svg',
'slug' => 'zoho',
'title' => esc_html__( 'Zoho Mail', 'wp-mail-smtp' ),
'disabled' => true,
)
);
}
/**
* {@inheritdoc}
*
* @since 2.3.0
*/
public function display_options() {
?>
<p>
<?php esc_html_e( 'We\'re sorry, the Zoho Mail mailer is not available on your plan. Please upgrade to the PRO plan to unlock all these awesome features.', 'wp-mail-smtp' ); ?>
</p>
<?php
}
}

View File

@ -114,6 +114,17 @@ class SiteHealth {
], ],
]; ];
// Install date.
$activated = get_option( 'wp_mail_smtp_activated', [] );
if ( ! empty( $activated['lite'] ) ) {
$date = $activated['lite'] + ( get_option( 'gmt_offset' ) * 3600 );
$debug_info[ self::DEBUG_INFO_SLUG ]['fields']['lite_install_date'] = [
'label' => esc_html__( 'Lite install date', 'wp-mail-smtp' ),
'value' => date_i18n( esc_html__( 'M j, Y @ g:ia' ), $date ),
];
}
return $debug_info; return $debug_info;
} }
@ -125,12 +136,19 @@ class SiteHealth {
public function mailer_setup_complete_test() { public function mailer_setup_complete_test() {
$mailer = Options::init()->get( 'mail', 'mailer' ); $mailer = Options::init()->get( 'mail', 'mailer' );
$mailer_complete = wp_mail_smtp() $mailer_complete = false;
->get_providers() $mailer_title = esc_html__( 'None selected', 'wp-mail-smtp' );
->get_mailer(
$mailer, if ( ! empty( $mailer ) ) {
wp_mail_smtp()->get_processor()->get_phpmailer() $mailer_complete = wp_mail_smtp()
)->is_mailer_complete(); ->get_providers()
->get_mailer(
$mailer,
wp_mail_smtp()->get_processor()->get_phpmailer()
)->is_mailer_complete();
$mailer_title = wp_mail_smtp()->get_providers()->get_options( $mailer )->get_title();
}
// The default mailer should be considered as a non-complete mailer. // The default mailer should be considered as a non-complete mailer.
if ( $mailer === 'mail' ) { if ( $mailer === 'mail' ) {
@ -140,7 +158,7 @@ class SiteHealth {
$mailer_text = sprintf( $mailer_text = sprintf(
'%s: <strong>%s</strong>', '%s: <strong>%s</strong>',
esc_html__( 'Current mailer', 'wp-mail-smtp' ), esc_html__( 'Current mailer', 'wp-mail-smtp' ),
esc_html( wp_mail_smtp()->get_providers()->get_options( $mailer )->get_title() ) esc_html( $mailer_title )
); );
$result = array( $result = array(
@ -250,7 +268,9 @@ class SiteHealth {
$existing_tables = []; $existing_tables = [];
foreach ( $tables as $table ) { foreach ( $tables as $table ) {
if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) ) !== $table ) { // phpcs:ignore $db_result = $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) ); // phpcs:ignore
if ( strtolower( $db_result ) !== strtolower( $table ) ) {
$missing_tables[] = $table; $missing_tables[] = $table;
} else { } else {
$existing_tables[] = $table; $existing_tables[] = $table;

View File

@ -385,7 +385,9 @@ class Meta {
} }
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching
return $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) ) === $table; $db_result = $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) );
return strtolower( $db_result ) === strtolower( $table );
} }
/** /**

View File

@ -203,18 +203,23 @@ class Task {
return $action_id; return $action_id;
} }
switch ( $this->type ) { // Prevent 500 errors when Action Scheduler tables don't exist.
case self::TYPE_ASYNC: try {
$action_id = $this->register_async(); switch ( $this->type ) {
break; case self::TYPE_ASYNC:
$action_id = $this->register_async();
break;
case self::TYPE_RECURRING: case self::TYPE_RECURRING:
$action_id = $this->register_recurring(); $action_id = $this->register_recurring();
break; break;
case self::TYPE_ONCE: case self::TYPE_ONCE:
$action_id = $this->register_once(); $action_id = $this->register_once();
break; break;
}
} catch ( \RuntimeException $exception ) {
$action_id = null;
} }
return $action_id; return $action_id;

View File

@ -23,6 +23,14 @@ class Tasks {
*/ */
public function init() { public function init() {
// Hide the Action Scheduler admin menu item.
add_action( 'admin_menu', array( $this, 'admin_hide_as_menu' ), PHP_INT_MAX );
// Skip tasks registration if Action Scheduler is not usable yet.
if ( ! $this->is_usable() ) {
return;
}
// Register tasks. // Register tasks.
foreach ( $this->get_tasks() as $task ) { foreach ( $this->get_tasks() as $task ) {
if ( ! is_subclass_of( $task, '\WPMailSMTP\Tasks\Task' ) ) { if ( ! is_subclass_of( $task, '\WPMailSMTP\Tasks\Task' ) ) {
@ -36,8 +44,6 @@ class Tasks {
$new_task->init(); $new_task->init();
} }
} }
add_action( 'admin_menu', array( $this, 'admin_hide_as_menu' ), PHP_INT_MAX );
} }
/** /**

View File

@ -0,0 +1,105 @@
<?php
namespace WPMailSMTP\UsageTracking;
use WPMailSMTP\Tasks\Task;
/**
* Class SendUsageTask.
*
* @since 2.3.0
*/
class SendUsageTask extends Task {
/**
* Action name for this task.
*
* @since 2.3.0
*/
const ACTION = 'wp_mail_smtp_send_usage_data';
/**
* Server URL to send requests to.
*
* @since 2.3.0
*
* @var string
*/
const TRACK_URL = 'https://usage.wpmailsmtp.com/v1/smtptrack';
/**
* Class constructor.
*
* @since 2.3.0
*/
public function __construct() {
parent::__construct( self::ACTION );
}
/**
* Initialize the task with all the proper checks.
*
* @since 2.3.0
*/
public function init() {
// Register the action handler.
add_action( self::ACTION, [ $this, 'process' ] );
if ( ! function_exists( 'as_next_scheduled_action' ) ) {
return;
}
// Add new if none exists.
if ( as_next_scheduled_action( self::ACTION ) !== false ) {
return;
}
$this->recurring( $this->generate_start_date(), WEEK_IN_SECONDS )
->register();
}
/**
* Randomly pick a timestamp
* which is not more than 1 week in the future
* starting from next sunday.
*
* @since 2.3.0
*
* @return int
*/
private function generate_start_date() {
$tracking = [];
$tracking['days'] = wp_rand( 0, 6 ) * DAY_IN_SECONDS;
$tracking['hours'] = wp_rand( 0, 23 ) * HOUR_IN_SECONDS;
$tracking['minutes'] = wp_rand( 0, 59 ) * MINUTE_IN_SECONDS;
$tracking['seconds'] = wp_rand( 0, 59 );
return strtotime( 'next sunday' ) + array_sum( $tracking );
}
/**
* Send the actual data in a POST request.
* This will be executed in a separate process via Action Scheduler.
*
* @since 2.3.0
*/
public function process() {
$ut = new UsageTracking();
wp_remote_post(
self::TRACK_URL,
[
'timeout' => 5,
'redirection' => 5,
'httpversion' => '1.1',
'blocking' => true,
'body' => $ut->get_data(),
'user-agent' => $ut->get_user_agent(),
]
);
}
}

View File

@ -0,0 +1,250 @@
<?php
namespace WPMailSMTP\UsageTracking;
use WPMailSMTP\Conflicts;
use WPMailSMTP\Options;
use WPMailSMTP\WP;
/**
* Usage Tracker functionality to understand what's going on on client's sites.
*
* @since 2.3.0
*/
class UsageTracking {
/**
* The slug that will be used to save the option of Usage Tracker.
*
* @since 2.3.0
*/
const SETTINGS_SLUG = 'usage-tracking-enabled';
/**
* Whether Usage Tracking is enabled.
* Needs to check with a fresh copy of options in order to provide accurate results.
*
* @since 2.3.0
*
* @return bool
*/
public function is_enabled() {
return (bool) apply_filters(
'wp_mail_smtp_usage_tracking_is_enabled',
( new Options() )->get( 'general', self::SETTINGS_SLUG )
);
}
/**
* Load usage tracking functionality.
*
* @since 2.3.0
*/
public function load() {
// Check if loading the usage tracking functionality is allowed.
if ( ! (bool) apply_filters( 'wp_mail_smtp_usage_tracking_load_allowed', true ) ) {
return;
}
// Deregister the action if option is disabled.
add_action(
'wp_mail_smtp_options_set_after',
function () {
if ( ! $this->is_enabled() ) {
( new SendUsageTask() )->cancel();
}
}
);
// Register the action handler only if enabled.
if ( $this->is_enabled() ) {
add_filter(
'wp_mail_smtp_tasks_get_tasks',
static function ( $tasks ) {
$tasks[] = SendUsageTask::class;
return $tasks;
}
);
}
}
/**
* Get the User Agent string that will be sent to the API.
*
* @since 2.3.0
*
* @return string
*/
public function get_user_agent() {
return 'WPMailSMTP/' . WPMS_PLUGIN_VER . '; ' . get_bloginfo( 'url' );
}
/**
* Get data for sending to the server.
*
* @since 2.3.0
*
* @return array
*/
public function get_data() {
global $wpdb;
$theme_data = wp_get_theme();
$activated_dates = get_option( 'wp_mail_smtp_activated', [] );
$options = Options::init();
$mailer = wp_mail_smtp()->get_providers()->get_mailer(
$options->get( 'mail', 'mailer' ),
wp_mail_smtp()->get_processor()->get_phpmailer()
);
$data = [
// Generic data (environment).
'url' => home_url(),
'php_version' => PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION,
'wp_version' => get_bloginfo( 'version' ),
'mysql_version' => $wpdb->db_version(),
'server_version' => isset( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : '',
'is_ssl' => is_ssl(),
'is_multisite' => is_multisite(),
'sites_count' => $this->get_sites_total(),
'active_plugins' => $this->get_active_plugins(),
'theme_name' => $theme_data->name,
'theme_version' => $theme_data->version,
'locale' => get_locale(),
'timezone_offset' => $this->get_timezone_offset(),
// WP Mail SMTP - specific data.
'wp_mail_smtp_version' => WPMS_PLUGIN_VER,
'wp_mail_smtp_license_key' => wp_mail_smtp()->get_license_key(),
'wp_mail_smtp_license_type' => wp_mail_smtp()->get_license_type(),
'wp_mail_smtp_is_pro' => wp_mail_smtp()->is_pro(),
'wp_mail_smtp_activated' => get_option( 'wp_mail_smtp_activated_time', 0 ),
'wp_mail_smtp_lite_installed_date' => $this->get_installed( $activated_dates, 'lite' ),
'wp_mail_smtp_pro_installed_date' => $this->get_installed( $activated_dates, 'pro' ),
'wp_mail_smtp_mailer' => $options->get( 'mail', 'mailer' ),
'wp_mail_smtp_from_email_force' => (bool) $options->get( 'mail', 'from_email_force' ),
'wp_mail_smtp_from_name_force' => (bool) $options->get( 'mail', 'from_name_force' ),
'wp_mail_smtp_return_path' => (bool) $options->get( 'mail', 'return_path' ),
'wp_mail_smtp_do_not_send' => (bool) $options->get( 'general', 'do_not_send' ),
'wp_mail_smtp_is_white_labeled' => wp_mail_smtp()->is_white_labeled(),
'wp_mail_smtp_is_const_enabled' => (bool) $options->is_const_enabled(),
'wp_mail_smtp_conflicts_is_detected' => ( new Conflicts() )->is_detected(),
'wp_mail_smtp_is_mailer_complete' => empty( $mailer ) ? false : $mailer->is_mailer_complete(),
];
if ( 'smtp' === $options->get( 'mail', 'mailer' ) ) {
$data['wp_mail_smtp_other_smtp_host'] = $options->get( 'smtp', 'host' );
$data['wp_mail_smtp_other_smtp_encryption'] = $options->get( 'smtp', 'encryption' );
$data['wp_mail_smtp_other_smtp_port'] = $options->get( 'smtp', 'port' );
$data['wp_mail_smtp_other_smtp_auth'] = (bool) $options->get( 'smtp', 'auth' );
$data['wp_mail_smtp_other_smtp_autotls'] = (bool) $options->get( 'smtp', 'autotls' );
}
if ( is_multisite() ) {
$data['wp_mail_smtp_multisite_network_wide'] = WP::use_global_plugin_settings();
}
return apply_filters( 'wp_mail_smtp_usage_tracking_get_data', $data );
}
/**
* Get timezone offset.
* We use `wp_timezone_string()` when it's available (WP 5.3+),
* otherwise fallback to the same code, copy-pasted.
*
* @since 2.3.0
*
* @return string
*/
private function get_timezone_offset() {
// It was added in WordPress 5.3.
if ( function_exists( 'wp_timezone_string' ) ) {
return wp_timezone_string();
}
/*
* The code below is basically a copy-paste from that function.
*/
$timezone_string = get_option( 'timezone_string' );
if ( $timezone_string ) {
return $timezone_string;
}
$offset = (float) get_option( 'gmt_offset' );
$hours = (int) $offset;
$minutes = ( $offset - $hours );
$sign = ( $offset < 0 ) ? '-' : '+';
$abs_hour = abs( $hours );
$abs_mins = abs( $minutes * 60 );
return sprintf( '%s%02d:%02d', $sign, $abs_hour, $abs_mins );
}
/**
* Get the list of active plugins.
*
* @since 2.3.0
*
* @return array
*/
private function get_active_plugins() {
if ( ! function_exists( 'get_plugins' ) ) {
include ABSPATH . '/wp-admin/includes/plugin.php';
}
$active_plugins = [];
foreach ( get_mu_plugins() as $path => $plugin ) {
$active_plugins[ $path ] = isset( $plugin['Version'] ) ? $plugin['Version'] : 'Not Set';
}
foreach ( get_plugins() as $path => $plugin ) {
if ( is_plugin_active( $path ) ) {
$active_plugins[ $path ] = isset( $plugin['Version'] ) ? $plugin['Version'] : 'Not Set';
}
}
return $active_plugins;
}
/**
* Installed date.
*
* @since 2.3.0
*
* @param array $activated_dates Input array with dates.
* @param string $key Input key what you want to get.
*
* @return mixed
*/
private function get_installed( $activated_dates, $key ) {
if ( ! empty( $activated_dates[ $key ] ) ) {
return $activated_dates[ $key ];
}
return false;
}
/**
* Total number of sites.
*
* @since 2.3.0
*
* @return int
*/
private function get_sites_total() {
return function_exists( 'get_blog_count' ) ? (int) get_blog_count() : 1;
}
}

View File

@ -247,12 +247,17 @@ class WP {
* @see https://github.com/WordPress/WordPress/blob/master/wp-includes/pluggable.php#L332 * @see https://github.com/WordPress/WordPress/blob/master/wp-includes/pluggable.php#L332
* *
* @since 2.2.0 * @since 2.2.0
* @since 2.3.0 In WP 5.5 the core code changed and is now using `network_home_url`.
* *
* @return string * @return string
*/ */
public static function get_default_email() { public static function get_default_email() {
$sitename = strtolower( $_SERVER['SERVER_NAME'] ); // phpcs:ignore if ( version_compare( get_bloginfo( 'version' ), '5.5-alpha', '<' ) ) {
$sitename = strtolower( $_SERVER['SERVER_NAME'] ); // phpcs:ignore
} else {
$sitename = wp_parse_url( network_home_url(), PHP_URL_HOST );
}
if ( 'www.' === substr( $sitename, 0, 4 ) ) { if ( 'www.' === substr( $sitename, 0, 4 ) ) {
$sitename = substr( $sitename, 4 ); $sitename = substr( $sitename, 4 );

View File

@ -47,6 +47,13 @@ $am_announcement_params = [
'fields' => 'ids', 'fields' => 'ids',
]; ];
/**
* Disable Action Schedule Queue Runner, to prevent a fatal error on the shutdown WP hook.
*/
if ( class_exists( 'ActionScheduler_QueueRunner' ) ) {
ActionScheduler_QueueRunner::instance()->unhook_dispatch_async_request();
}
// WP MS uninstall process. // WP MS uninstall process.
if ( is_multisite() ) { if ( is_multisite() ) {
$main_site_settings = get_blog_option( get_main_site_id(), 'wp_mail_smtp', [] ); $main_site_settings = get_blog_option( get_main_site_id(), 'wp_mail_smtp', [] );

View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit72f613a3d0c2cc77892490951b6e5352::getLoader(); return ComposerAutoloaderInitecc5aee58cbc7fae6cdc39ef5e9f1f73::getLoader();

View File

@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir);
return array( return array(
'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'), 'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
'Wikimedia\\Composer\\' => array($vendorDir . '/wikimedia/composer-merge-plugin/src'),
'WPMailSMTP\\' => array($baseDir . '/src'), 'WPMailSMTP\\' => array($baseDir . '/src'),
'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'), 'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInit72f613a3d0c2cc77892490951b6e5352 class ComposerAutoloaderInitecc5aee58cbc7fae6cdc39ef5e9f1f73
{ {
private static $loader; private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit72f613a3d0c2cc77892490951b6e5352
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInit72f613a3d0c2cc77892490951b6e5352', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInitecc5aee58cbc7fae6cdc39ef5e9f1f73', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit72f613a3d0c2cc77892490951b6e5352', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitecc5aee58cbc7fae6cdc39ef5e9f1f73', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) { if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php'; require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit72f613a3d0c2cc77892490951b6e5352::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInitecc5aee58cbc7fae6cdc39ef5e9f1f73::getInitializer($loader));
} else { } else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
@ -51,19 +51,19 @@ class ComposerAutoloaderInit72f613a3d0c2cc77892490951b6e5352
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit72f613a3d0c2cc77892490951b6e5352::$files; $includeFiles = Composer\Autoload\ComposerStaticInitecc5aee58cbc7fae6cdc39ef5e9f1f73::$files;
} else { } else {
$includeFiles = require __DIR__ . '/autoload_files.php'; $includeFiles = require __DIR__ . '/autoload_files.php';
} }
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire72f613a3d0c2cc77892490951b6e5352($fileIdentifier, $file); composerRequireecc5aee58cbc7fae6cdc39ef5e9f1f73($fileIdentifier, $file);
} }
return $loader; return $loader;
} }
} }
function composerRequire72f613a3d0c2cc77892490951b6e5352($fileIdentifier, $file) function composerRequireecc5aee58cbc7fae6cdc39ef5e9f1f73($fileIdentifier, $file)
{ {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file; require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInit72f613a3d0c2cc77892490951b6e5352 class ComposerStaticInitecc5aee58cbc7fae6cdc39ef5e9f1f73
{ {
public static $files = array ( public static $files = array (
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
@ -24,6 +24,7 @@ class ComposerStaticInit72f613a3d0c2cc77892490951b6e5352
), ),
'W' => 'W' =>
array ( array (
'Wikimedia\\Composer\\' => 19,
'WPMailSMTP\\' => 11, 'WPMailSMTP\\' => 11,
), ),
'S' => 'S' =>
@ -65,6 +66,10 @@ class ComposerStaticInit72f613a3d0c2cc77892490951b6e5352
array ( array (
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib', 0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
), ),
'Wikimedia\\Composer\\' =>
array (
0 => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src',
),
'WPMailSMTP\\' => 'WPMailSMTP\\' =>
array ( array (
0 => __DIR__ . '/../..' . '/src', 0 => __DIR__ . '/../..' . '/src',
@ -149,10 +154,10 @@ class ComposerStaticInit72f613a3d0c2cc77892490951b6e5352
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit72f613a3d0c2cc77892490951b6e5352::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInitecc5aee58cbc7fae6cdc39ef5e9f1f73::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit72f613a3d0c2cc77892490951b6e5352::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInitecc5aee58cbc7fae6cdc39ef5e9f1f73::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInit72f613a3d0c2cc77892490951b6e5352::$prefixesPsr0; $loader->prefixesPsr0 = ComposerStaticInitecc5aee58cbc7fae6cdc39ef5e9f1f73::$prefixesPsr0;
$loader->classMap = ComposerStaticInit72f613a3d0c2cc77892490951b6e5352::$classMap; $loader->classMap = ComposerStaticInitecc5aee58cbc7fae6cdc39ef5e9f1f73::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }

View File

@ -19,7 +19,8 @@
* Service definition for Gmail (v1). * Service definition for Gmail (v1).
* *
* <p> * <p>
* Access Gmail mailboxes including sending user email.</p> * The Gmail API lets you view and manage Gmail mailbox data like threads,
* messages, and labels.</p>
* *
* <p> * <p>
* For more information about this service, see the API * For more information about this service, see the API
@ -97,7 +98,7 @@ class Google_Service_Gmail extends Google_Service
{ {
parent::__construct($client); parent::__construct($client);
$this->rootUrl = $rootUrl ?: 'https://www.googleapis.com/'; $this->rootUrl = $rootUrl ?: 'https://www.googleapis.com/';
$this->servicePath = 'gmail/v1/users/'; $this->servicePath = '';
$this->batchPath = 'batch/gmail/v1'; $this->batchPath = 'batch/gmail/v1';
$this->version = 'v1'; $this->version = 'v1';
$this->serviceName = 'gmail'; $this->serviceName = 'gmail';
@ -109,7 +110,7 @@ class Google_Service_Gmail extends Google_Service
array( array(
'methods' => array( 'methods' => array(
'getProfile' => array( 'getProfile' => array(
'path' => '{userId}/profile', 'path' => 'gmail/v1/users/{userId}/profile',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -119,7 +120,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'stop' => array( ),'stop' => array(
'path' => '{userId}/stop', 'path' => 'gmail/v1/users/{userId}/stop',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -129,7 +130,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'watch' => array( ),'watch' => array(
'path' => '{userId}/watch', 'path' => 'gmail/v1/users/{userId}/watch',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -149,7 +150,7 @@ class Google_Service_Gmail extends Google_Service
array( array(
'methods' => array( 'methods' => array(
'create' => array( 'create' => array(
'path' => '{userId}/drafts', 'path' => 'gmail/v1/users/{userId}/drafts',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -159,7 +160,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'delete' => array( ),'delete' => array(
'path' => '{userId}/drafts/{id}', 'path' => 'gmail/v1/users/{userId}/drafts/{id}',
'httpMethod' => 'DELETE', 'httpMethod' => 'DELETE',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -174,7 +175,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'get' => array( ),'get' => array(
'path' => '{userId}/drafts/{id}', 'path' => 'gmail/v1/users/{userId}/drafts/{id}',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -193,7 +194,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'list' => array( ),'list' => array(
'path' => '{userId}/drafts', 'path' => 'gmail/v1/users/{userId}/drafts',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -201,25 +202,25 @@ class Google_Service_Gmail extends Google_Service
'type' => 'string', 'type' => 'string',
'required' => true, 'required' => true,
), ),
'includeSpamTrash' => array( 'pageToken' => array(
'location' => 'query', 'location' => 'query',
'type' => 'boolean', 'type' => 'string',
), ),
'maxResults' => array( 'maxResults' => array(
'location' => 'query', 'location' => 'query',
'type' => 'integer', 'type' => 'integer',
), ),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
),
'q' => array( 'q' => array(
'location' => 'query', 'location' => 'query',
'type' => 'string', 'type' => 'string',
), ),
'includeSpamTrash' => array(
'location' => 'query',
'type' => 'boolean',
),
), ),
),'send' => array( ),'send' => array(
'path' => '{userId}/drafts/send', 'path' => 'gmail/v1/users/{userId}/drafts/send',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -229,7 +230,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'update' => array( ),'update' => array(
'path' => '{userId}/drafts/{id}', 'path' => 'gmail/v1/users/{userId}/drafts/{id}',
'httpMethod' => 'PUT', 'httpMethod' => 'PUT',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -254,7 +255,7 @@ class Google_Service_Gmail extends Google_Service
array( array(
'methods' => array( 'methods' => array(
'list' => array( 'list' => array(
'path' => '{userId}/history', 'path' => 'gmail/v1/users/{userId}/history',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -267,22 +268,22 @@ class Google_Service_Gmail extends Google_Service
'type' => 'string', 'type' => 'string',
'repeated' => true, 'repeated' => true,
), ),
'startHistoryId' => array(
'location' => 'query',
'type' => 'string',
),
'labelId' => array( 'labelId' => array(
'location' => 'query', 'location' => 'query',
'type' => 'string', 'type' => 'string',
), ),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
),
'maxResults' => array( 'maxResults' => array(
'location' => 'query', 'location' => 'query',
'type' => 'integer', 'type' => 'integer',
), ),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
),
'startHistoryId' => array(
'location' => 'query',
'type' => 'string',
),
), ),
), ),
) )
@ -295,7 +296,7 @@ class Google_Service_Gmail extends Google_Service
array( array(
'methods' => array( 'methods' => array(
'create' => array( 'create' => array(
'path' => '{userId}/labels', 'path' => 'gmail/v1/users/{userId}/labels',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -305,7 +306,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'delete' => array( ),'delete' => array(
'path' => '{userId}/labels/{id}', 'path' => 'gmail/v1/users/{userId}/labels/{id}',
'httpMethod' => 'DELETE', 'httpMethod' => 'DELETE',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -320,7 +321,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'get' => array( ),'get' => array(
'path' => '{userId}/labels/{id}', 'path' => 'gmail/v1/users/{userId}/labels/{id}',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -335,7 +336,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'list' => array( ),'list' => array(
'path' => '{userId}/labels', 'path' => 'gmail/v1/users/{userId}/labels',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -345,7 +346,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'patch' => array( ),'patch' => array(
'path' => '{userId}/labels/{id}', 'path' => 'gmail/v1/users/{userId}/labels/{id}',
'httpMethod' => 'PATCH', 'httpMethod' => 'PATCH',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -360,7 +361,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'update' => array( ),'update' => array(
'path' => '{userId}/labels/{id}', 'path' => 'gmail/v1/users/{userId}/labels/{id}',
'httpMethod' => 'PUT', 'httpMethod' => 'PUT',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -385,7 +386,7 @@ class Google_Service_Gmail extends Google_Service
array( array(
'methods' => array( 'methods' => array(
'batchDelete' => array( 'batchDelete' => array(
'path' => '{userId}/messages/batchDelete', 'path' => 'gmail/v1/users/{userId}/messages/batchDelete',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -395,7 +396,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'batchModify' => array( ),'batchModify' => array(
'path' => '{userId}/messages/batchModify', 'path' => 'gmail/v1/users/{userId}/messages/batchModify',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -405,7 +406,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'delete' => array( ),'delete' => array(
'path' => '{userId}/messages/{id}', 'path' => 'gmail/v1/users/{userId}/messages/{id}',
'httpMethod' => 'DELETE', 'httpMethod' => 'DELETE',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -420,7 +421,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'get' => array( ),'get' => array(
'path' => '{userId}/messages/{id}', 'path' => 'gmail/v1/users/{userId}/messages/{id}',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -444,7 +445,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'import' => array( ),'import' => array(
'path' => '{userId}/messages/import', 'path' => 'gmail/v1/users/{userId}/messages/import',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -452,6 +453,10 @@ class Google_Service_Gmail extends Google_Service
'type' => 'string', 'type' => 'string',
'required' => true, 'required' => true,
), ),
'processForCalendar' => array(
'location' => 'query',
'type' => 'boolean',
),
'deleted' => array( 'deleted' => array(
'location' => 'query', 'location' => 'query',
'type' => 'boolean', 'type' => 'boolean',
@ -464,13 +469,9 @@ class Google_Service_Gmail extends Google_Service
'location' => 'query', 'location' => 'query',
'type' => 'boolean', 'type' => 'boolean',
), ),
'processForCalendar' => array(
'location' => 'query',
'type' => 'boolean',
),
), ),
),'insert' => array( ),'insert' => array(
'path' => '{userId}/messages', 'path' => 'gmail/v1/users/{userId}/messages',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -478,17 +479,17 @@ class Google_Service_Gmail extends Google_Service
'type' => 'string', 'type' => 'string',
'required' => true, 'required' => true,
), ),
'deleted' => array(
'location' => 'query',
'type' => 'boolean',
),
'internalDateSource' => array( 'internalDateSource' => array(
'location' => 'query', 'location' => 'query',
'type' => 'string', 'type' => 'string',
), ),
'deleted' => array(
'location' => 'query',
'type' => 'boolean',
),
), ),
),'list' => array( ),'list' => array(
'path' => '{userId}/messages', 'path' => 'gmail/v1/users/{userId}/messages',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -496,19 +497,11 @@ class Google_Service_Gmail extends Google_Service
'type' => 'string', 'type' => 'string',
'required' => true, 'required' => true,
), ),
'includeSpamTrash' => array(
'location' => 'query',
'type' => 'boolean',
),
'labelIds' => array( 'labelIds' => array(
'location' => 'query', 'location' => 'query',
'type' => 'string', 'type' => 'string',
'repeated' => true, 'repeated' => true,
), ),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
'pageToken' => array( 'pageToken' => array(
'location' => 'query', 'location' => 'query',
'type' => 'string', 'type' => 'string',
@ -517,9 +510,17 @@ class Google_Service_Gmail extends Google_Service
'location' => 'query', 'location' => 'query',
'type' => 'string', 'type' => 'string',
), ),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
'includeSpamTrash' => array(
'location' => 'query',
'type' => 'boolean',
),
), ),
),'modify' => array( ),'modify' => array(
'path' => '{userId}/messages/{id}/modify', 'path' => 'gmail/v1/users/{userId}/messages/{id}/modify',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -534,7 +535,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'send' => array( ),'send' => array(
'path' => '{userId}/messages/send', 'path' => 'gmail/v1/users/{userId}/messages/send',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -544,7 +545,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'trash' => array( ),'trash' => array(
'path' => '{userId}/messages/{id}/trash', 'path' => 'gmail/v1/users/{userId}/messages/{id}/trash',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -559,7 +560,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'untrash' => array( ),'untrash' => array(
'path' => '{userId}/messages/{id}/untrash', 'path' => 'gmail/v1/users/{userId}/messages/{id}/untrash',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -584,7 +585,7 @@ class Google_Service_Gmail extends Google_Service
array( array(
'methods' => array( 'methods' => array(
'get' => array( 'get' => array(
'path' => '{userId}/messages/{messageId}/attachments/{id}', 'path' => 'gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -614,7 +615,7 @@ class Google_Service_Gmail extends Google_Service
array( array(
'methods' => array( 'methods' => array(
'getAutoForwarding' => array( 'getAutoForwarding' => array(
'path' => '{userId}/settings/autoForwarding', 'path' => 'gmail/v1/users/{userId}/settings/autoForwarding',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -624,7 +625,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'getImap' => array( ),'getImap' => array(
'path' => '{userId}/settings/imap', 'path' => 'gmail/v1/users/{userId}/settings/imap',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -634,7 +635,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'getLanguage' => array( ),'getLanguage' => array(
'path' => '{userId}/settings/language', 'path' => 'gmail/v1/users/{userId}/settings/language',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -644,7 +645,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'getPop' => array( ),'getPop' => array(
'path' => '{userId}/settings/pop', 'path' => 'gmail/v1/users/{userId}/settings/pop',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -654,7 +655,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'getVacation' => array( ),'getVacation' => array(
'path' => '{userId}/settings/vacation', 'path' => 'gmail/v1/users/{userId}/settings/vacation',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -664,7 +665,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'updateAutoForwarding' => array( ),'updateAutoForwarding' => array(
'path' => '{userId}/settings/autoForwarding', 'path' => 'gmail/v1/users/{userId}/settings/autoForwarding',
'httpMethod' => 'PUT', 'httpMethod' => 'PUT',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -674,7 +675,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'updateImap' => array( ),'updateImap' => array(
'path' => '{userId}/settings/imap', 'path' => 'gmail/v1/users/{userId}/settings/imap',
'httpMethod' => 'PUT', 'httpMethod' => 'PUT',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -684,7 +685,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'updateLanguage' => array( ),'updateLanguage' => array(
'path' => '{userId}/settings/language', 'path' => 'gmail/v1/users/{userId}/settings/language',
'httpMethod' => 'PUT', 'httpMethod' => 'PUT',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -694,7 +695,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'updatePop' => array( ),'updatePop' => array(
'path' => '{userId}/settings/pop', 'path' => 'gmail/v1/users/{userId}/settings/pop',
'httpMethod' => 'PUT', 'httpMethod' => 'PUT',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -704,7 +705,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'updateVacation' => array( ),'updateVacation' => array(
'path' => '{userId}/settings/vacation', 'path' => 'gmail/v1/users/{userId}/settings/vacation',
'httpMethod' => 'PUT', 'httpMethod' => 'PUT',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -724,7 +725,7 @@ class Google_Service_Gmail extends Google_Service
array( array(
'methods' => array( 'methods' => array(
'create' => array( 'create' => array(
'path' => '{userId}/settings/delegates', 'path' => 'gmail/v1/users/{userId}/settings/delegates',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -734,7 +735,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'delete' => array( ),'delete' => array(
'path' => '{userId}/settings/delegates/{delegateEmail}', 'path' => 'gmail/v1/users/{userId}/settings/delegates/{delegateEmail}',
'httpMethod' => 'DELETE', 'httpMethod' => 'DELETE',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -749,7 +750,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'get' => array( ),'get' => array(
'path' => '{userId}/settings/delegates/{delegateEmail}', 'path' => 'gmail/v1/users/{userId}/settings/delegates/{delegateEmail}',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -764,7 +765,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'list' => array( ),'list' => array(
'path' => '{userId}/settings/delegates', 'path' => 'gmail/v1/users/{userId}/settings/delegates',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -784,7 +785,7 @@ class Google_Service_Gmail extends Google_Service
array( array(
'methods' => array( 'methods' => array(
'create' => array( 'create' => array(
'path' => '{userId}/settings/filters', 'path' => 'gmail/v1/users/{userId}/settings/filters',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -794,7 +795,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'delete' => array( ),'delete' => array(
'path' => '{userId}/settings/filters/{id}', 'path' => 'gmail/v1/users/{userId}/settings/filters/{id}',
'httpMethod' => 'DELETE', 'httpMethod' => 'DELETE',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -809,7 +810,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'get' => array( ),'get' => array(
'path' => '{userId}/settings/filters/{id}', 'path' => 'gmail/v1/users/{userId}/settings/filters/{id}',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -824,7 +825,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'list' => array( ),'list' => array(
'path' => '{userId}/settings/filters', 'path' => 'gmail/v1/users/{userId}/settings/filters',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -844,7 +845,7 @@ class Google_Service_Gmail extends Google_Service
array( array(
'methods' => array( 'methods' => array(
'create' => array( 'create' => array(
'path' => '{userId}/settings/forwardingAddresses', 'path' => 'gmail/v1/users/{userId}/settings/forwardingAddresses',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -854,7 +855,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'delete' => array( ),'delete' => array(
'path' => '{userId}/settings/forwardingAddresses/{forwardingEmail}', 'path' => 'gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}',
'httpMethod' => 'DELETE', 'httpMethod' => 'DELETE',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -869,7 +870,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'get' => array( ),'get' => array(
'path' => '{userId}/settings/forwardingAddresses/{forwardingEmail}', 'path' => 'gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -884,7 +885,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'list' => array( ),'list' => array(
'path' => '{userId}/settings/forwardingAddresses', 'path' => 'gmail/v1/users/{userId}/settings/forwardingAddresses',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -904,7 +905,7 @@ class Google_Service_Gmail extends Google_Service
array( array(
'methods' => array( 'methods' => array(
'create' => array( 'create' => array(
'path' => '{userId}/settings/sendAs', 'path' => 'gmail/v1/users/{userId}/settings/sendAs',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -914,7 +915,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'delete' => array( ),'delete' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}', 'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}',
'httpMethod' => 'DELETE', 'httpMethod' => 'DELETE',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -929,7 +930,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'get' => array( ),'get' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}', 'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -944,7 +945,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'list' => array( ),'list' => array(
'path' => '{userId}/settings/sendAs', 'path' => 'gmail/v1/users/{userId}/settings/sendAs',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -954,7 +955,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'patch' => array( ),'patch' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}', 'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}',
'httpMethod' => 'PATCH', 'httpMethod' => 'PATCH',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -969,7 +970,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'update' => array( ),'update' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}', 'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}',
'httpMethod' => 'PUT', 'httpMethod' => 'PUT',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -984,7 +985,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'verify' => array( ),'verify' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}/verify', 'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -1009,7 +1010,7 @@ class Google_Service_Gmail extends Google_Service
array( array(
'methods' => array( 'methods' => array(
'delete' => array( 'delete' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}', 'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}',
'httpMethod' => 'DELETE', 'httpMethod' => 'DELETE',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -1029,7 +1030,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'get' => array( ),'get' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}', 'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -1049,7 +1050,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'insert' => array( ),'insert' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo', 'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -1064,7 +1065,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'list' => array( ),'list' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo', 'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -1079,7 +1080,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'setDefault' => array( ),'setDefault' => array(
'path' => '{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault', 'path' => 'gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -1109,7 +1110,7 @@ class Google_Service_Gmail extends Google_Service
array( array(
'methods' => array( 'methods' => array(
'delete' => array( 'delete' => array(
'path' => '{userId}/threads/{id}', 'path' => 'gmail/v1/users/{userId}/threads/{id}',
'httpMethod' => 'DELETE', 'httpMethod' => 'DELETE',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -1124,7 +1125,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'get' => array( ),'get' => array(
'path' => '{userId}/threads/{id}', 'path' => 'gmail/v1/users/{userId}/threads/{id}',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -1148,7 +1149,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'list' => array( ),'list' => array(
'path' => '{userId}/threads', 'path' => 'gmail/v1/users/{userId}/threads',
'httpMethod' => 'GET', 'httpMethod' => 'GET',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -1156,30 +1157,30 @@ class Google_Service_Gmail extends Google_Service
'type' => 'string', 'type' => 'string',
'required' => true, 'required' => true,
), ),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
'includeSpamTrash' => array( 'includeSpamTrash' => array(
'location' => 'query', 'location' => 'query',
'type' => 'boolean', 'type' => 'boolean',
), ),
'q' => array(
'location' => 'query',
'type' => 'string',
),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
),
'labelIds' => array( 'labelIds' => array(
'location' => 'query', 'location' => 'query',
'type' => 'string', 'type' => 'string',
'repeated' => true, 'repeated' => true,
), ),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
),
'q' => array(
'location' => 'query',
'type' => 'string',
),
), ),
),'modify' => array( ),'modify' => array(
'path' => '{userId}/threads/{id}/modify', 'path' => 'gmail/v1/users/{userId}/threads/{id}/modify',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -1194,7 +1195,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'trash' => array( ),'trash' => array(
'path' => '{userId}/threads/{id}/trash', 'path' => 'gmail/v1/users/{userId}/threads/{id}/trash',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(
@ -1209,7 +1210,7 @@ class Google_Service_Gmail extends Google_Service
), ),
), ),
),'untrash' => array( ),'untrash' => array(
'path' => '{userId}/threads/{id}/untrash', 'path' => 'gmail/v1/users/{userId}/threads/{id}/untrash',
'httpMethod' => 'POST', 'httpMethod' => 'POST',
'parameters' => array( 'parameters' => array(
'userId' => array( 'userId' => array(

View File

@ -28,7 +28,7 @@ class Google_Service_Gmail_Resource_Users extends Google_Service_Resource
/** /**
* Gets the current user's Gmail profile. (users.getProfile) * Gets the current user's Gmail profile. (users.getProfile)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* @return Google_Service_Gmail_Profile * @return Google_Service_Gmail_Profile
@ -42,7 +42,7 @@ class Google_Service_Gmail_Resource_Users extends Google_Service_Resource
/** /**
* Stop receiving push notifications for the given user mailbox. (users.stop) * Stop receiving push notifications for the given user mailbox. (users.stop)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
*/ */
@ -56,7 +56,7 @@ class Google_Service_Gmail_Resource_Users extends Google_Service_Resource
* Set up or update a push notification watch on the given user mailbox. * Set up or update a push notification watch on the given user mailbox.
* (users.watch) * (users.watch)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_WatchRequest $postBody * @param Google_Service_Gmail_WatchRequest $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.

View File

@ -26,9 +26,9 @@
class Google_Service_Gmail_Resource_UsersDrafts extends Google_Service_Resource class Google_Service_Gmail_Resource_UsersDrafts extends Google_Service_Resource
{ {
/** /**
* Creates a new draft with the DRAFT label. (drafts.create) * Creates a new draft with the `DRAFT` label. (drafts.create)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_Draft $postBody * @param Google_Service_Gmail_Draft $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -44,7 +44,7 @@ class Google_Service_Gmail_Resource_UsersDrafts extends Google_Service_Resource
* Immediately and permanently deletes the specified draft. Does not simply * Immediately and permanently deletes the specified draft. Does not simply
* trash it. (drafts.delete) * trash it. (drafts.delete)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the draft to delete. * @param string $id The ID of the draft to delete.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -58,7 +58,7 @@ class Google_Service_Gmail_Resource_UsersDrafts extends Google_Service_Resource
/** /**
* Gets the specified draft. (drafts.get) * Gets the specified draft. (drafts.get)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the draft to retrieve. * @param string $id The ID of the draft to retrieve.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -75,18 +75,18 @@ class Google_Service_Gmail_Resource_UsersDrafts extends Google_Service_Resource
/** /**
* Lists the drafts in the user's mailbox. (drafts.listUsersDrafts) * Lists the drafts in the user's mailbox. (drafts.listUsersDrafts)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* *
* @opt_param bool includeSpamTrash Include drafts from SPAM and TRASH in the
* results.
* @opt_param string maxResults Maximum number of drafts to return.
* @opt_param string pageToken Page token to retrieve a specific page of results * @opt_param string pageToken Page token to retrieve a specific page of results
* in the list. * in the list.
* @opt_param string maxResults Maximum number of drafts to return.
* @opt_param string q Only return draft messages matching the specified query. * @opt_param string q Only return draft messages matching the specified query.
* Supports the same query format as the Gmail search box. For example, * Supports the same query format as the Gmail search box. For example,
* "from:someuser@example.com rfc822msgid: is:unread". * `"from:someuser@example.com rfc822msgid: is:unread"`.
* @opt_param bool includeSpamTrash Include drafts from `SPAM` and `TRASH` in
* the results.
* @return Google_Service_Gmail_ListDraftsResponse * @return Google_Service_Gmail_ListDraftsResponse
*/ */
public function listUsersDrafts($userId, $optParams = array()) public function listUsersDrafts($userId, $optParams = array())
@ -96,10 +96,10 @@ class Google_Service_Gmail_Resource_UsersDrafts extends Google_Service_Resource
return $this->call('list', array($params), "Google_Service_Gmail_ListDraftsResponse"); return $this->call('list', array($params), "Google_Service_Gmail_ListDraftsResponse");
} }
/** /**
* Sends the specified, existing draft to the recipients in the To, Cc, and Bcc * Sends the specified, existing draft to the recipients in the `To`, `Cc`, and
* headers. (drafts.send) * `Bcc` headers. (drafts.send)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_Draft $postBody * @param Google_Service_Gmail_Draft $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -114,7 +114,7 @@ class Google_Service_Gmail_Resource_UsersDrafts extends Google_Service_Resource
/** /**
* Replaces a draft's content. (drafts.update) * Replaces a draft's content. (drafts.update)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the draft to update. * @param string $id The ID of the draft to update.
* @param Google_Service_Gmail_Draft $postBody * @param Google_Service_Gmail_Draft $postBody

View File

@ -27,29 +27,29 @@ class Google_Service_Gmail_Resource_UsersHistory extends Google_Service_Resource
{ {
/** /**
* Lists the history of all changes to the given mailbox. History results are * Lists the history of all changes to the given mailbox. History results are
* returned in chronological order (increasing historyId). * returned in chronological order (increasing `historyId`).
* (history.listUsersHistory) * (history.listUsersHistory)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* *
* @opt_param string historyTypes History types to be returned by the function * @opt_param string historyTypes History types to be returned by the function
* @opt_param string startHistoryId Required. Returns history records after the
* specified `startHistoryId`. The supplied `startHistoryId` should be obtained
* from the `historyId` of a message, thread, or previous `list` response.
* History IDs increase chronologically but are not contiguous with random gaps
* in between valid IDs. Supplying an invalid or out of date `startHistoryId`
* typically returns an `HTTP 404` error code. A `historyId` is typically valid
* for at least a week, but in some rare circumstances may be valid for only a
* few hours. If you receive an `HTTP 404` error response, your application
* should perform a full sync. If you receive no `nextPageToken` in the
* response, there are no updates to retrieve and you can store the returned
* `historyId` for a future request.
* @opt_param string labelId Only return messages with a label matching the ID. * @opt_param string labelId Only return messages with a label matching the ID.
* @opt_param string maxResults The maximum number of history records to return.
* @opt_param string pageToken Page token to retrieve a specific page of results * @opt_param string pageToken Page token to retrieve a specific page of results
* in the list. * in the list.
* @opt_param string startHistoryId Required. Returns history records after the * @opt_param string maxResults The maximum number of history records to return.
* specified startHistoryId. The supplied startHistoryId should be obtained from
* the historyId of a message, thread, or previous list response. History IDs
* increase chronologically but are not contiguous with random gaps in between
* valid IDs. Supplying an invalid or out of date startHistoryId typically
* returns an HTTP 404 error code. A historyId is typically valid for at least a
* week, but in some rare circumstances may be valid for only a few hours. If
* you receive an HTTP 404 error response, your application should perform a
* full sync. If you receive no nextPageToken in the response, there are no
* updates to retrieve and you can store the returned historyId for a future
* request.
* @return Google_Service_Gmail_ListHistoryResponse * @return Google_Service_Gmail_ListHistoryResponse
*/ */
public function listUsersHistory($userId, $optParams = array()) public function listUsersHistory($userId, $optParams = array())

View File

@ -28,7 +28,7 @@ class Google_Service_Gmail_Resource_UsersLabels extends Google_Service_Resource
/** /**
* Creates a new label. (labels.create) * Creates a new label. (labels.create)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_Label $postBody * @param Google_Service_Gmail_Label $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -44,7 +44,7 @@ class Google_Service_Gmail_Resource_UsersLabels extends Google_Service_Resource
* Immediately and permanently deletes the specified label and removes it from * Immediately and permanently deletes the specified label and removes it from
* any messages and threads that it is applied to. (labels.delete) * any messages and threads that it is applied to. (labels.delete)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the label to delete. * @param string $id The ID of the label to delete.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -58,7 +58,7 @@ class Google_Service_Gmail_Resource_UsersLabels extends Google_Service_Resource
/** /**
* Gets the specified label. (labels.get) * Gets the specified label. (labels.get)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the label to retrieve. * @param string $id The ID of the label to retrieve.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -73,7 +73,7 @@ class Google_Service_Gmail_Resource_UsersLabels extends Google_Service_Resource
/** /**
* Lists all labels in the user's mailbox. (labels.listUsersLabels) * Lists all labels in the user's mailbox. (labels.listUsersLabels)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* @return Google_Service_Gmail_ListLabelsResponse * @return Google_Service_Gmail_ListLabelsResponse
@ -85,10 +85,9 @@ class Google_Service_Gmail_Resource_UsersLabels extends Google_Service_Resource
return $this->call('list', array($params), "Google_Service_Gmail_ListLabelsResponse"); return $this->call('list', array($params), "Google_Service_Gmail_ListLabelsResponse");
} }
/** /**
* Updates the specified label. This method supports patch semantics. * Patch the specified label. (labels.patch)
* (labels.patch)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the label to update. * @param string $id The ID of the label to update.
* @param Google_Service_Gmail_Label $postBody * @param Google_Service_Gmail_Label $postBody
@ -104,7 +103,7 @@ class Google_Service_Gmail_Resource_UsersLabels extends Google_Service_Resource
/** /**
* Updates the specified label. (labels.update) * Updates the specified label. (labels.update)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the label to update. * @param string $id The ID of the label to update.
* @param Google_Service_Gmail_Label $postBody * @param Google_Service_Gmail_Label $postBody

View File

@ -26,10 +26,10 @@
class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resource class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resource
{ {
/** /**
* Deletes many messages by message ID. Provides no guarantees that messages * Deletes many messages by message ID. Provides no guarantees that messages
* were not already deleted or even existed at all. (messages.batchDelete) * were not already deleted or even existed at all. (messages.batchDelete)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_BatchDeleteMessagesRequest $postBody * @param Google_Service_Gmail_BatchDeleteMessagesRequest $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -43,7 +43,7 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
/** /**
* Modifies the labels on the specified messages. (messages.batchModify) * Modifies the labels on the specified messages. (messages.batchModify)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_BatchModifyMessagesRequest $postBody * @param Google_Service_Gmail_BatchModifyMessagesRequest $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -56,9 +56,9 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
} }
/** /**
* Immediately and permanently deletes the specified message. This operation * Immediately and permanently deletes the specified message. This operation
* cannot be undone. Prefer messages.trash instead. (messages.delete) * cannot be undone. Prefer `messages.trash` instead. (messages.delete)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the message to delete. * @param string $id The ID of the message to delete.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -72,13 +72,13 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
/** /**
* Gets the specified message. (messages.get) * Gets the specified message. (messages.get)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the message to retrieve. * @param string $id The ID of the message to retrieve.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* *
* @opt_param string format The format to return the message in. * @opt_param string format The format to return the message in.
* @opt_param string metadataHeaders When given and format is METADATA, only * @opt_param string metadataHeaders When given and format is `METADATA`, only
* include headers specified. * include headers specified.
* @return Google_Service_Gmail_Message * @return Google_Service_Gmail_Message
*/ */
@ -93,11 +93,13 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
* scanning and classification similar to receiving via SMTP. Does not send a * scanning and classification similar to receiving via SMTP. Does not send a
* message. (messages.import) * message. (messages.import)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_Message $postBody * @param Google_Service_Gmail_Message $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* *
* @opt_param bool processForCalendar Process calendar invites in the email and
* add any extracted meetings to the Google Calendar for this user.
* @opt_param bool deleted Mark the email as permanently deleted (not TRASH) and * @opt_param bool deleted Mark the email as permanently deleted (not TRASH) and
* only visible in Google Vault to a Vault administrator. Only used for G Suite * only visible in Google Vault to a Vault administrator. Only used for G Suite
* accounts. * accounts.
@ -105,8 +107,6 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
* message. * message.
* @opt_param bool neverMarkSpam Ignore the Gmail spam classifier decision and * @opt_param bool neverMarkSpam Ignore the Gmail spam classifier decision and
* never mark this email as SPAM in the mailbox. * never mark this email as SPAM in the mailbox.
* @opt_param bool processForCalendar Process calendar invites in the email and
* add any extracted meetings to the Google Calendar for this user.
* @return Google_Service_Gmail_Message * @return Google_Service_Gmail_Message
*/ */
public function import($userId, Google_Service_Gmail_Message $postBody, $optParams = array()) public function import($userId, Google_Service_Gmail_Message $postBody, $optParams = array())
@ -116,20 +116,20 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
return $this->call('import', array($params), "Google_Service_Gmail_Message"); return $this->call('import', array($params), "Google_Service_Gmail_Message");
} }
/** /**
* Directly inserts a message into only this user's mailbox similar to IMAP * Directly inserts a message into only this user's mailbox similar to `IMAP
* APPEND, bypassing most scanning and classification. Does not send a message. * APPEND`, bypassing most scanning and classification. Does not send a message.
* (messages.insert) * (messages.insert)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_Message $postBody * @param Google_Service_Gmail_Message $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* *
* @opt_param string internalDateSource Source for Gmail's internal date of the
* message.
* @opt_param bool deleted Mark the email as permanently deleted (not TRASH) and * @opt_param bool deleted Mark the email as permanently deleted (not TRASH) and
* only visible in Google Vault to a Vault administrator. Only used for G Suite * only visible in Google Vault to a Vault administrator. Only used for G Suite
* accounts. * accounts.
* @opt_param string internalDateSource Source for Gmail's internal date of the
* message.
* @return Google_Service_Gmail_Message * @return Google_Service_Gmail_Message
*/ */
public function insert($userId, Google_Service_Gmail_Message $postBody, $optParams = array()) public function insert($userId, Google_Service_Gmail_Message $postBody, $optParams = array())
@ -141,21 +141,21 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
/** /**
* Lists the messages in the user's mailbox. (messages.listUsersMessages) * Lists the messages in the user's mailbox. (messages.listUsersMessages)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* *
* @opt_param bool includeSpamTrash Include messages from SPAM and TRASH in the
* results.
* @opt_param string labelIds Only return messages with labels that match all of * @opt_param string labelIds Only return messages with labels that match all of
* the specified label IDs. * the specified label IDs.
* @opt_param string maxResults Maximum number of messages to return.
* @opt_param string pageToken Page token to retrieve a specific page of results * @opt_param string pageToken Page token to retrieve a specific page of results
* in the list. * in the list.
* @opt_param string q Only return messages matching the specified query. * @opt_param string q Only return messages matching the specified query.
* Supports the same query format as the Gmail search box. For example, * Supports the same query format as the Gmail search box. For example,
* "from:someuser@example.com rfc822msgid: is:unread". Parameter cannot be used * `"from:someuser@example.com rfc822msgid: is:unread"`. Parameter cannot be
* when accessing the api using the gmail.metadata scope. * used when accessing the api using the gmail.metadata scope.
* @opt_param string maxResults Maximum number of messages to return.
* @opt_param bool includeSpamTrash Include messages from `SPAM` and `TRASH` in
* the results.
* @return Google_Service_Gmail_ListMessagesResponse * @return Google_Service_Gmail_ListMessagesResponse
*/ */
public function listUsersMessages($userId, $optParams = array()) public function listUsersMessages($userId, $optParams = array())
@ -167,7 +167,7 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
/** /**
* Modifies the labels on the specified message. (messages.modify) * Modifies the labels on the specified message. (messages.modify)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the message to modify. * @param string $id The ID of the message to modify.
* @param Google_Service_Gmail_ModifyMessageRequest $postBody * @param Google_Service_Gmail_ModifyMessageRequest $postBody
@ -181,10 +181,10 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
return $this->call('modify', array($params), "Google_Service_Gmail_Message"); return $this->call('modify', array($params), "Google_Service_Gmail_Message");
} }
/** /**
* Sends the specified message to the recipients in the To, Cc, and Bcc headers. * Sends the specified message to the recipients in the `To`, `Cc`, and `Bcc`
* (messages.send) * headers. (messages.send)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_Message $postBody * @param Google_Service_Gmail_Message $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -199,7 +199,7 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
/** /**
* Moves the specified message to the trash. (messages.trash) * Moves the specified message to the trash. (messages.trash)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the message to Trash. * @param string $id The ID of the message to Trash.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -214,7 +214,7 @@ class Google_Service_Gmail_Resource_UsersMessages extends Google_Service_Resourc
/** /**
* Removes the specified message from the trash. (messages.untrash) * Removes the specified message from the trash. (messages.untrash)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the message to remove from Trash. * @param string $id The ID of the message to remove from Trash.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.

View File

@ -28,7 +28,7 @@ class Google_Service_Gmail_Resource_UsersMessagesAttachments extends Google_Serv
/** /**
* Gets the specified message attachment. (attachments.get) * Gets the specified message attachment. (attachments.get)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $messageId The ID of the message containing the attachment. * @param string $messageId The ID of the message containing the attachment.
* @param string $id The ID of the attachment. * @param string $id The ID of the attachment.

View File

@ -29,7 +29,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
* Gets the auto-forwarding setting for the specified account. * Gets the auto-forwarding setting for the specified account.
* (settings.getAutoForwarding) * (settings.getAutoForwarding)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* @return Google_Service_Gmail_AutoForwarding * @return Google_Service_Gmail_AutoForwarding
@ -43,7 +43,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
/** /**
* Gets IMAP settings. (settings.getImap) * Gets IMAP settings. (settings.getImap)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* @return Google_Service_Gmail_ImapSettings * @return Google_Service_Gmail_ImapSettings
@ -57,7 +57,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
/** /**
* Gets language settings. (settings.getLanguage) * Gets language settings. (settings.getLanguage)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* @return Google_Service_Gmail_LanguageSettings * @return Google_Service_Gmail_LanguageSettings
@ -71,7 +71,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
/** /**
* Gets POP settings. (settings.getPop) * Gets POP settings. (settings.getPop)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* @return Google_Service_Gmail_PopSettings * @return Google_Service_Gmail_PopSettings
@ -85,7 +85,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
/** /**
* Gets vacation responder settings. (settings.getVacation) * Gets vacation responder settings. (settings.getVacation)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* @return Google_Service_Gmail_VacationSettings * @return Google_Service_Gmail_VacationSettings
@ -97,13 +97,13 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
return $this->call('getVacation', array($params), "Google_Service_Gmail_VacationSettings"); return $this->call('getVacation', array($params), "Google_Service_Gmail_VacationSettings");
} }
/** /**
* Updates the auto-forwarding setting for the specified account. A verified * Updates the auto-forwarding setting for the specified account. A verified
* forwarding address must be specified when auto-forwarding is enabled. * forwarding address must be specified when auto-forwarding is enabled.
* *
* This method is only available to service account clients that have been * This method is only available to service account clients that have been
* delegated domain-wide authority. (settings.updateAutoForwarding) * delegated domain-wide authority. (settings.updateAutoForwarding)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_AutoForwarding $postBody * @param Google_Service_Gmail_AutoForwarding $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -118,7 +118,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
/** /**
* Updates IMAP settings. (settings.updateImap) * Updates IMAP settings. (settings.updateImap)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_ImapSettings $postBody * @param Google_Service_Gmail_ImapSettings $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -133,13 +133,13 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
/** /**
* Updates language settings. * Updates language settings.
* *
* If successful, the return object contains the displayLanguage that was saved * If successful, the return object contains the `displayLanguage` that was
* for the user, which may differ from the value passed into the request. This * saved for the user, which may differ from the value passed into the request.
* is because the requested displayLanguage may not be directly supported by * This is because the requested `displayLanguage` may not be directly supported
* Gmail but have a close variant that is, and so the variant may be chosen and * by Gmail but have a close variant that is, and so the variant may be chosen
* saved instead. (settings.updateLanguage) * and saved instead. (settings.updateLanguage)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_LanguageSettings $postBody * @param Google_Service_Gmail_LanguageSettings $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -154,7 +154,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
/** /**
* Updates POP settings. (settings.updatePop) * Updates POP settings. (settings.updatePop)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_PopSettings $postBody * @param Google_Service_Gmail_PopSettings $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -169,7 +169,7 @@ class Google_Service_Gmail_Resource_UsersSettings extends Google_Service_Resourc
/** /**
* Updates vacation responder settings. (settings.updateVacation) * Updates vacation responder settings. (settings.updateVacation)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_VacationSettings $postBody * @param Google_Service_Gmail_VacationSettings $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.

View File

@ -26,9 +26,9 @@
class Google_Service_Gmail_Resource_UsersSettingsDelegates extends Google_Service_Resource class Google_Service_Gmail_Resource_UsersSettingsDelegates extends Google_Service_Resource
{ {
/** /**
* Adds a delegate with its verification status set directly to accepted, * Adds a delegate with its verification status set directly to `accepted`,
* without sending any verification email. The delegate user must be a member of * without sending any verification email. The delegate user must be a member
* the same G Suite organization as the delegator user. * of the same G Suite organization as the delegator user.
* *
* Gmail imposes limitations on the number of delegates and delegators each user * Gmail imposes limitations on the number of delegates and delegators each user
* in a G Suite organization can have. These limits depend on your organization, * in a G Suite organization can have. These limits depend on your organization,
@ -43,7 +43,7 @@ class Google_Service_Gmail_Resource_UsersSettingsDelegates extends Google_Servic
* This method is only available to service account clients that have been * This method is only available to service account clients that have been
* delegated domain-wide authority. (delegates.create) * delegated domain-wide authority. (delegates.create)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_Delegate $postBody * @param Google_Service_Gmail_Delegate $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -65,7 +65,7 @@ class Google_Service_Gmail_Resource_UsersSettingsDelegates extends Google_Servic
* This method is only available to service account clients that have been * This method is only available to service account clients that have been
* delegated domain-wide authority. (delegates.delete) * delegated domain-wide authority. (delegates.delete)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $delegateEmail The email address of the user to be removed as a * @param string $delegateEmail The email address of the user to be removed as a
* delegate. * delegate.
@ -86,7 +86,7 @@ class Google_Service_Gmail_Resource_UsersSettingsDelegates extends Google_Servic
* This method is only available to service account clients that have been * This method is only available to service account clients that have been
* delegated domain-wide authority. (delegates.get) * delegated domain-wide authority. (delegates.get)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $delegateEmail The email address of the user whose delegate * @param string $delegateEmail The email address of the user whose delegate
* relationship is to be retrieved. * relationship is to be retrieved.
@ -105,7 +105,7 @@ class Google_Service_Gmail_Resource_UsersSettingsDelegates extends Google_Servic
* This method is only available to service account clients that have been * This method is only available to service account clients that have been
* delegated domain-wide authority. (delegates.listUsersSettingsDelegates) * delegated domain-wide authority. (delegates.listUsersSettingsDelegates)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* @return Google_Service_Gmail_ListDelegatesResponse * @return Google_Service_Gmail_ListDelegatesResponse

View File

@ -26,15 +26,15 @@
class Google_Service_Gmail_Resource_UsersSettingsForwardingAddresses extends Google_Service_Resource class Google_Service_Gmail_Resource_UsersSettingsForwardingAddresses extends Google_Service_Resource
{ {
/** /**
* Creates a forwarding address. If ownership verification is required, a * Creates a forwarding address. If ownership verification is required, a
* message will be sent to the recipient and the resource's verification status * message will be sent to the recipient and the resource's verification status
* will be set to pending; otherwise, the resource will be created with * will be set to `pending`; otherwise, the resource will be created with
* verification status set to accepted. * verification status set to `accepted`.
* *
* This method is only available to service account clients that have been * This method is only available to service account clients that have been
* delegated domain-wide authority. (forwardingAddresses.create) * delegated domain-wide authority. (forwardingAddresses.create)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_ForwardingAddress $postBody * @param Google_Service_Gmail_ForwardingAddress $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -53,7 +53,7 @@ class Google_Service_Gmail_Resource_UsersSettingsForwardingAddresses extends Goo
* This method is only available to service account clients that have been * This method is only available to service account clients that have been
* delegated domain-wide authority. (forwardingAddresses.delete) * delegated domain-wide authority. (forwardingAddresses.delete)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $forwardingEmail The forwarding address to be deleted. * @param string $forwardingEmail The forwarding address to be deleted.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -67,7 +67,7 @@ class Google_Service_Gmail_Resource_UsersSettingsForwardingAddresses extends Goo
/** /**
* Gets the specified forwarding address. (forwardingAddresses.get) * Gets the specified forwarding address. (forwardingAddresses.get)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $forwardingEmail The forwarding address to be retrieved. * @param string $forwardingEmail The forwarding address to be retrieved.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -83,7 +83,7 @@ class Google_Service_Gmail_Resource_UsersSettingsForwardingAddresses extends Goo
* Lists the forwarding addresses for the specified account. * Lists the forwarding addresses for the specified account.
* (forwardingAddresses.listUsersSettingsForwardingAddresses) * (forwardingAddresses.listUsersSettingsForwardingAddresses)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* @return Google_Service_Gmail_ListForwardingAddressesResponse * @return Google_Service_Gmail_ListForwardingAddressesResponse

View File

@ -26,18 +26,18 @@
class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_Resource class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_Resource
{ {
/** /**
* Creates a custom "from" send-as alias. If an SMTP MSA is specified, Gmail * Creates a custom "from" send-as alias. If an SMTP MSA is specified, Gmail
* will attempt to connect to the SMTP service to validate the configuration * will attempt to connect to the SMTP service to validate the configuration
* before creating the alias. If ownership verification is required for the * before creating the alias. If ownership verification is required for the
* alias, a message will be sent to the email address and the resource's * alias, a message will be sent to the email address and the resource's
* verification status will be set to pending; otherwise, the resource will be * verification status will be set to `pending`; otherwise, the resource will be
* created with verification status set to accepted. If a signature is provided, * created with verification status set to `accepted`. If a signature is
* Gmail will sanitize the HTML before saving it with the alias. * provided, Gmail will sanitize the HTML before saving it with the alias.
* *
* This method is only available to service account clients that have been * This method is only available to service account clients that have been
* delegated domain-wide authority. (sendAs.create) * delegated domain-wide authority. (sendAs.create)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param Google_Service_Gmail_SendAs $postBody * @param Google_Service_Gmail_SendAs $postBody
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -50,13 +50,13 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_R
return $this->call('create', array($params), "Google_Service_Gmail_SendAs"); return $this->call('create', array($params), "Google_Service_Gmail_SendAs");
} }
/** /**
* Deletes the specified send-as alias. Revokes any verification that may have * Deletes the specified send-as alias. Revokes any verification that may have
* been required for using it. * been required for using it.
* *
* This method is only available to service account clients that have been * This method is only available to service account clients that have been
* delegated domain-wide authority. (sendAs.delete) * delegated domain-wide authority. (sendAs.delete)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $sendAsEmail The send-as alias to be deleted. * @param string $sendAsEmail The send-as alias to be deleted.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -68,10 +68,10 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_R
return $this->call('delete', array($params)); return $this->call('delete', array($params));
} }
/** /**
* Gets the specified send-as alias. Fails with an HTTP 404 error if the * Gets the specified send-as alias. Fails with an HTTP 404 error if the
* specified address is not a member of the collection. (sendAs.get) * specified address is not a member of the collection. (sendAs.get)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $sendAsEmail The send-as alias to be retrieved. * @param string $sendAsEmail The send-as alias to be retrieved.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -84,11 +84,11 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_R
return $this->call('get', array($params), "Google_Service_Gmail_SendAs"); return $this->call('get', array($params), "Google_Service_Gmail_SendAs");
} }
/** /**
* Lists the send-as aliases for the specified account. The result includes the * Lists the send-as aliases for the specified account. The result includes the
* primary send-as address associated with the account as well as any custom * primary send-as address associated with the account as well as any custom
* "from" aliases. (sendAs.listUsersSettingsSendAs) * "from" aliases. (sendAs.listUsersSettingsSendAs)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* @return Google_Service_Gmail_ListSendAsResponse * @return Google_Service_Gmail_ListSendAsResponse
@ -100,14 +100,9 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_R
return $this->call('list', array($params), "Google_Service_Gmail_ListSendAsResponse"); return $this->call('list', array($params), "Google_Service_Gmail_ListSendAsResponse");
} }
/** /**
* Updates a send-as alias. If a signature is provided, Gmail will sanitize the * Patch the specified send-as alias. (sendAs.patch)
* HTML before saving it with the alias.
* *
* Addresses other than the primary address for the account can only be updated * @param string $userId User's email address. The special value "me" can be
* by service account clients that have been delegated domain-wide authority.
* This method supports patch semantics. (sendAs.patch)
*
* @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $sendAsEmail The send-as alias to be updated. * @param string $sendAsEmail The send-as alias to be updated.
* @param Google_Service_Gmail_SendAs $postBody * @param Google_Service_Gmail_SendAs $postBody
@ -121,14 +116,14 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_R
return $this->call('patch', array($params), "Google_Service_Gmail_SendAs"); return $this->call('patch', array($params), "Google_Service_Gmail_SendAs");
} }
/** /**
* Updates a send-as alias. If a signature is provided, Gmail will sanitize the * Updates a send-as alias. If a signature is provided, Gmail will sanitize the
* HTML before saving it with the alias. * HTML before saving it with the alias.
* *
* Addresses other than the primary address for the account can only be updated * Addresses other than the primary address for the account can only be updated
* by service account clients that have been delegated domain-wide authority. * by service account clients that have been delegated domain-wide authority.
* (sendAs.update) * (sendAs.update)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $sendAsEmail The send-as alias to be updated. * @param string $sendAsEmail The send-as alias to be updated.
* @param Google_Service_Gmail_SendAs $postBody * @param Google_Service_Gmail_SendAs $postBody
@ -143,12 +138,12 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAs extends Google_Service_R
} }
/** /**
* Sends a verification email to the specified send-as alias address. The * Sends a verification email to the specified send-as alias address. The
* verification status must be pending. * verification status must be `pending`.
* *
* This method is only available to service account clients that have been * This method is only available to service account clients that have been
* delegated domain-wide authority. (sendAs.verify) * delegated domain-wide authority. (sendAs.verify)
* *
* @param string $userId User's email address. The special value "me" can be * @param string $userId User's email address. The special value "me" can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $sendAsEmail The send-as alias to be verified. * @param string $sendAsEmail The send-as alias to be verified.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.

View File

@ -29,7 +29,7 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAsSmimeInfo extends Google_
* Deletes the specified S/MIME config for the specified send-as alias. * Deletes the specified S/MIME config for the specified send-as alias.
* (smimeInfo.delete) * (smimeInfo.delete)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $sendAsEmail The email address that appears in the "From:" * @param string $sendAsEmail The email address that appears in the "From:"
* header for mail sent using this alias. * header for mail sent using this alias.
@ -46,7 +46,7 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAsSmimeInfo extends Google_
* Gets the specified S/MIME config for the specified send-as alias. * Gets the specified S/MIME config for the specified send-as alias.
* (smimeInfo.get) * (smimeInfo.get)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $sendAsEmail The email address that appears in the "From:" * @param string $sendAsEmail The email address that appears in the "From:"
* header for mail sent using this alias. * header for mail sent using this alias.
@ -64,7 +64,7 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAsSmimeInfo extends Google_
* Insert (upload) the given S/MIME config for the specified send-as alias. Note * Insert (upload) the given S/MIME config for the specified send-as alias. Note
* that pkcs12 format is required for the key. (smimeInfo.insert) * that pkcs12 format is required for the key. (smimeInfo.insert)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $sendAsEmail The email address that appears in the "From:" * @param string $sendAsEmail The email address that appears in the "From:"
* header for mail sent using this alias. * header for mail sent using this alias.
@ -82,7 +82,7 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAsSmimeInfo extends Google_
* Lists S/MIME configs for the specified send-as alias. * Lists S/MIME configs for the specified send-as alias.
* (smimeInfo.listUsersSettingsSendAsSmimeInfo) * (smimeInfo.listUsersSettingsSendAsSmimeInfo)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $sendAsEmail The email address that appears in the "From:" * @param string $sendAsEmail The email address that appears in the "From:"
* header for mail sent using this alias. * header for mail sent using this alias.
@ -99,7 +99,7 @@ class Google_Service_Gmail_Resource_UsersSettingsSendAsSmimeInfo extends Google_
* Sets the default S/MIME config for the specified send-as alias. * Sets the default S/MIME config for the specified send-as alias.
* (smimeInfo.setDefault) * (smimeInfo.setDefault)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $sendAsEmail The email address that appears in the "From:" * @param string $sendAsEmail The email address that appears in the "From:"
* header for mail sent using this alias. * header for mail sent using this alias.

View File

@ -27,9 +27,9 @@ class Google_Service_Gmail_Resource_UsersThreads extends Google_Service_Resource
{ {
/** /**
* Immediately and permanently deletes the specified thread. This operation * Immediately and permanently deletes the specified thread. This operation
* cannot be undone. Prefer threads.trash instead. (threads.delete) * cannot be undone. Prefer `threads.trash` instead. (threads.delete)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id ID of the Thread to delete. * @param string $id ID of the Thread to delete.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -43,7 +43,7 @@ class Google_Service_Gmail_Resource_UsersThreads extends Google_Service_Resource
/** /**
* Gets the specified thread. (threads.get) * Gets the specified thread. (threads.get)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the thread to retrieve. * @param string $id The ID of the thread to retrieve.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -62,21 +62,21 @@ class Google_Service_Gmail_Resource_UsersThreads extends Google_Service_Resource
/** /**
* Lists the threads in the user's mailbox. (threads.listUsersThreads) * Lists the threads in the user's mailbox. (threads.listUsersThreads)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
* *
* @opt_param bool includeSpamTrash Include threads from SPAM and TRASH in the
* results.
* @opt_param string labelIds Only return threads with labels that match all of
* the specified label IDs.
* @opt_param string maxResults Maximum number of threads to return. * @opt_param string maxResults Maximum number of threads to return.
* @opt_param string pageToken Page token to retrieve a specific page of results * @opt_param bool includeSpamTrash Include threads from `SPAM` and `TRASH` in
* in the list. * the results.
* @opt_param string q Only return threads matching the specified query. * @opt_param string q Only return threads matching the specified query.
* Supports the same query format as the Gmail search box. For example, * Supports the same query format as the Gmail search box. For example,
* "from:someuser@example.com rfc822msgid: is:unread". Parameter cannot be used * `"from:someuser@example.com rfc822msgid: is:unread"`. Parameter cannot be
* when accessing the api using the gmail.metadata scope. * used when accessing the api using the gmail.metadata scope.
* @opt_param string pageToken Page token to retrieve a specific page of results
* in the list.
* @opt_param string labelIds Only return threads with labels that match all of
* the specified label IDs.
* @return Google_Service_Gmail_ListThreadsResponse * @return Google_Service_Gmail_ListThreadsResponse
*/ */
public function listUsersThreads($userId, $optParams = array()) public function listUsersThreads($userId, $optParams = array())
@ -89,7 +89,7 @@ class Google_Service_Gmail_Resource_UsersThreads extends Google_Service_Resource
* Modifies the labels applied to the thread. This applies to all messages in * Modifies the labels applied to the thread. This applies to all messages in
* the thread. (threads.modify) * the thread. (threads.modify)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the thread to modify. * @param string $id The ID of the thread to modify.
* @param Google_Service_Gmail_ModifyThreadRequest $postBody * @param Google_Service_Gmail_ModifyThreadRequest $postBody
@ -105,7 +105,7 @@ class Google_Service_Gmail_Resource_UsersThreads extends Google_Service_Resource
/** /**
* Moves the specified thread to the trash. (threads.trash) * Moves the specified thread to the trash. (threads.trash)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the thread to Trash. * @param string $id The ID of the thread to Trash.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.
@ -120,7 +120,7 @@ class Google_Service_Gmail_Resource_UsersThreads extends Google_Service_Resource
/** /**
* Removes the specified thread from the trash. (threads.untrash) * Removes the specified thread from the trash. (threads.untrash)
* *
* @param string $userId The user's email address. The special value me can be * @param string $userId The user's email address. The special value `me` can be
* used to indicate the authenticated user. * used to indicate the authenticated user.
* @param string $id The ID of the thread to remove from Trash. * @param string $id The ID of the thread to remove from Trash.
* @param array $optParams Optional parameters. * @param array $optParams Optional parameters.

View File

@ -25,6 +25,7 @@ use Google\Auth\Iam;
use Google\Auth\ProjectIdProviderInterface; use Google\Auth\ProjectIdProviderInterface;
use Google\Auth\SignBlobInterface; use Google\Auth\SignBlobInterface;
use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\ServerException; use GuzzleHttp\Exception\ServerException;
use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Request;
@ -283,6 +284,7 @@ class GCECredentials extends CredentialsLoader implements
} catch (ClientException $e) { } catch (ClientException $e) {
} catch (ServerException $e) { } catch (ServerException $e) {
} catch (RequestException $e) { } catch (RequestException $e) {
} catch (ConnectException $e) {
} }
} }
return false; return false;

View File

@ -84,14 +84,23 @@ class FetchAuthTokenCache implements
// TODO: correct caching; enable the cache to be cleared. // TODO: correct caching; enable the cache to be cleared.
$cacheKey = $this->fetcher->getCacheKey(); $cacheKey = $this->fetcher->getCacheKey();
$cached = $this->getCachedValue($cacheKey); $cached = $this->getCachedValue($cacheKey);
if (!empty($cached)) { if (is_array($cached)) {
return ['access_token' => $cached]; if (empty($cached['expires_at'])) {
// If there is no expiration data, assume token is not expired.
// (for JwtAccess and ID tokens)
return $cached;
}
if (time() < $cached['expires_at']) {
// access token is not expired
return $cached;
}
} }
$auth_token = $this->fetcher->fetchAuthToken($httpHandler); $auth_token = $this->fetcher->fetchAuthToken($httpHandler);
if (isset($auth_token['access_token'])) { if (isset($auth_token['access_token']) ||
$this->setCachedValue($cacheKey, $auth_token['access_token']); isset($auth_token['id_token'])) {
$this->setCachedValue($cacheKey, $auth_token);
} }
return $auth_token; return $auth_token;

View File

@ -124,7 +124,11 @@ class AuthTokenMiddleware
if (array_key_exists('access_token', $auth_tokens)) { if (array_key_exists('access_token', $auth_tokens)) {
// notify the callback if applicable // notify the callback if applicable
if ($this->tokenCallback) { if ($this->tokenCallback) {
call_user_func($this->tokenCallback, $this->fetcher->getCacheKey(), $auth_tokens['access_token']); call_user_func(
$this->tokenCallback,
$this->fetcher->getCacheKey(),
$auth_tokens['access_token']
);
} }
return $auth_tokens['access_token']; return $auth_tokens['access_token'];

View File

@ -543,6 +543,10 @@ class OAuth2 implements FetchAuthTokenInterface
return implode(':', $this->scope); return implode(':', $this->scope);
} }
if ($this->audience) {
return $this->audience;
}
// If scope has not set, return null to indicate no caching. // If scope has not set, return null to indicate no caching.
return null; return null;
} }

View File

@ -86,7 +86,7 @@ class RavenHandler extends AbstractProcessingHandler
// the record with the highest severity is the "main" one // the record with the highest severity is the "main" one
$record = array_reduce($records, function ($highest, $record) { $record = array_reduce($records, function ($highest, $record) {
if ($record['level'] > $highest['level']) { if (null === $highest || $record['level'] > $highest['level']) {
return $record; return $record;
} }

View File

@ -106,7 +106,8 @@ class StreamHandler extends AbstractProcessingHandler
restore_error_handler(); restore_error_handler();
if (!is_resource($this->stream)) { if (!is_resource($this->stream)) {
$this->stream = null; $this->stream = null;
throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened: '.$this->errorMessage, $this->url));
throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened in append mode: '.$this->errorMessage, $this->url));
} }
} }

View File

@ -52,6 +52,10 @@ class WebProcessor implements ProcessorInterface
throw new \UnexpectedValueException('$serverData must be an array or object implementing ArrayAccess.'); throw new \UnexpectedValueException('$serverData must be an array or object implementing ArrayAccess.');
} }
if (isset($this->serverData['UNIQUE_ID'])) {
$this->extraFields['unique_id'] = 'UNIQUE_ID';
}
if (null !== $extraFields) { if (null !== $extraFields) {
if (isset($extraFields[0])) { if (isset($extraFields[0])) {
foreach (array_keys($this->extraFields) as $fieldName) { foreach (array_keys($this->extraFields) as $fieldName) {
@ -104,10 +108,6 @@ class WebProcessor implements ProcessorInterface
$extra[$extraName] = isset($this->serverData[$serverName]) ? $this->serverData[$serverName] : null; $extra[$extraName] = isset($this->serverData[$serverName]) ? $this->serverData[$serverName] : null;
} }
if (isset($this->serverData['UNIQUE_ID'])) {
$extra['unique_id'] = $this->serverData['UNIQUE_ID'];
}
return $extra; return $extra;
} }
} }

View File

@ -1,7 +1,9 @@
<?php <?php
/** /**
* Plugin Name: WP Mail SMTP * Plugin Name: WP Mail SMTP
* Version: 2.2.1 * Version: 2.3.1
* Requires at least: 4.9
* Requires PHP: 5.5
* Plugin URI: https://wpmailsmtp.com/ * Plugin URI: https://wpmailsmtp.com/
* Description: Reconfigures the <code>wp_mail()</code> function to use Gmail/Mailgun/SendGrid/SMTP instead of the default <code>mail()</code> and creates an options page to manage the settings. * Description: Reconfigures the <code>wp_mail()</code> function to use Gmail/Mailgun/SendGrid/SMTP instead of the default <code>mail()</code> and creates an options page to manage the settings.
* Author: WPForms * Author: WPForms
@ -203,7 +205,7 @@ if ( ! function_exists( 'wp_mail_smtp_insecure_php_version_notice' ) ) {
} }
if ( ! defined( 'WPMS_PLUGIN_VER' ) ) { if ( ! defined( 'WPMS_PLUGIN_VER' ) ) {
define( 'WPMS_PLUGIN_VER', '2.2.1' ); define( 'WPMS_PLUGIN_VER', '2.3.1' );
} }
if ( ! defined( 'WPMS_PHP_VER' ) ) { if ( ! defined( 'WPMS_PHP_VER' ) ) {
define( 'WPMS_PHP_VER', '5.5.0' ); define( 'WPMS_PHP_VER', '5.5.0' );