array( 'type' => array(), 'id' => array(), 'name' => array(), 'value' => array(), 'class' => array(), 'placeholder' => array(), 'size' => array(), 'checked' => array(), 'required' => array(), 'data-error' => array(), 'readonly' => array() ), 'div' => array( 'class' => array() ), 'label' => array( 'class' => array() ), 'span' => array( 'class' => array() ), 'b' => array(), 'a' => array( 'href' => array(), 'target' => array(), 'class' => array(), 'id' => array() ), 'p' => array(), 'h3' => array(), 'select' => array( 'name' => array() ), 'option' => array( 'value' => array(), 'selected' => array() ) ); private $socket_sequence = array( 'gmail_api', 'sendinblue_api', 'sendgrid_api', 'mailgun_api', 'elasticemail_api', 'mandrill_api', 'postmark_api', 'sparkpost_api', 'mailjet_api', 'office365_api', 'aws_ses_api', 'zohomail_api', 'smtp', 'default' ); /** * Constructor for the class * * @since 2.7.0 * @version 1.0.0 */ public function __construct() { add_filter( 'post_smtp_legacy_wizard', '__return_false' ); add_action( 'post_smtp_new_wizard', array( $this, 'load_wizard' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_action( 'wp_ajax_ps-save-wizard', array( $this, 'save_wizard' ) ); add_action( 'admin_action_zoho_auth_request', array( $this, 'auth_zoho' ) ); if( isset( $_GET['wizard'] ) && $_GET['wizard'] == 'legacy' ) { add_filter( 'post_smtp_legacy_wizard', '__return_true' ); } $this->options_array = get_option( PostmanOptions::POSTMAN_OPTIONS ); } /** * Load the wizard | Action Callback * * @since 2.7.0 * @version 1.0.0 */ public function load_wizard() { $transports = PostmanTransportRegistry::getInstance()->getTransports(); //Not for wizard $settings_registry = new PostmanSettingsRegistry(); $this->options = PostmanOptions::getInstance(); $is_active = ( isset( $_GET['step'] ) && $_GET['step'] == 2 ) ? 'ps-active-nav' : 'ps-in-active-nav'; $in_active = ( isset( $_GET['step'] ) && $_GET['step'] != 1 ) ? '' : 'ps-active-nav'; $selected_tansport = $this->options->getTransportType(); $socket = isset( $_GET['socket'] ) ? "{$_GET['socket']}-outer" : ''; ?>
| Choose your SMTP Mailer | ||
| Configure Mailer Settings | ||
| Send Test Email |
'. sprintf( '%1$s', esc_html__( 'This address, like the letterhead printed on a letter, identifies the sender to the recipient. Change this when you are sending on behalf of someone else.', 'post-smtp' ) ) .'
'.__( 'The email address that emails are sent from.', 'post-smtp' ).''.__( 'The SMTP option lets you send emails directly through an SMTP server instead of using a SMTP Server provider\'s API. This is easy and convenient, but it\'s less secure than the other mailers.', 'post-smtp' ).'
'.sprintf( '%1$s %3$s', __( 'Let\'s get started with our ', 'post-smtp' ), esc_url( 'https://postmansmtp.com/documentation/sockets-addons/configure-post-smtp-with-other-smtp' ), __( 'SMTP Documentation', 'post-smtp' ) ).'
'; $html .= ''.sprintf( '%1$s %3$s %4$s', __( 'Our', 'post-smtp' ), esc_url( 'https://www.google.com/gmail/about/' ), __( 'Gmail mailer', 'post-smtp' ), __( 'works with any Gmail or Google Workspace account via the Google API. You can send WordPress emails from your main email address and it\'s more secure than directly connecting to Gmail using SMTP credentials.', 'post-smtp' ) ).'
'; $html .= __( 'The configuration steps are more technical than other options, so our detailed guide will walk you through the whole process.', 'post-smtp' ); $html .= ''.sprintf( '%1$s %3$s', __( 'Let’s get started with our', 'post-smtp' ), esc_url( 'https://postmansmtp.com/documentation/sockets-addons/gmail/' ), __( 'Gmail Documentation', 'post-smtp' ) ).'
'; $html .= ''.__( 'Before continuing, you\'ll need to allow this plugin to send emails using Gmail API.', 'post-smtp' ).'
Connect to Gmail API'; return $html; } /** * Render Mandrill Settings * * @since 2.7.0 * @version 1.0.0 */ public function render_mandrill_settings() { $api_key = null !== $this->options->getMandrillApiKey() ? esc_attr ( $this->options->getMandrillApiKey() ) : ''; $html = sprintf( '%2$s %3$s
%4$s %6$s
', esc_url( 'https://mandrillapp.com/login/?referrer=%2F' ), __( 'Mandrill', 'post-smtp' ), __( 'is an email infrastructure service offered as an add-on for MailChimp that you can use to send personalized, one-to-one e-commerce emails, or automated transactional emails.You can easily send WordPress emails from your Mandrill account.', 'post-smtp' ), __( 'Let’s get started with our', 'post-smtp' ), esc_url( 'https://postmansmtp.com/documentation/sockets-addons/how-to-setup-mandrill-with-post-smtp/' ), __( 'Mandrill Documentation', 'post-smtp' ) ); $html .= '%2$s %3$s
%4$s %6$s
', esc_url( 'https://sendgrid.com/' ), __( 'SendGrid', 'post-smtp' ), __( 'is a popular transactional email provider that sends more than 35 billion emails every month. If you\'re just starting out, the free plan allows you to send up to 100 emails each day without entering your credit card details.', 'post-smtp' ), __( 'Let’s get started with our', 'post-smtp' ), esc_url( 'https://postmansmtp.com/documentation/sockets-addons/how-to-setup-sendgrid-with-post-smtp/' ), __( 'SendGrid Documentation', 'post-smtp' ) ); $html .= '%2$s %3$s
%4$s %6$s
', esc_url( 'https://www.mailgun.com/' ), __( 'Mailgun', 'post-smtp' ), __( 'is a transactional email provider that offers a generous 3-month free trial. After that, it offers a \'Pay As You Grow\' plan that allows you to pay for what you use without committing to a fixed monthly rate.', 'post-smtp' ), __( 'Let’s get started with our', 'post-smtp' ), esc_url( 'https://postmansmtp.com/documentation/sockets-addons/how-to-configure-post-smtp-with-mail-gun/' ), __( 'Mailgun Documentation', 'post-smtp' ) ); $html .= 'Brevo %2$s
%3$s
%4$s %6$s', esc_url( 'https://www.brevo.com/products/transactional-email/?tap_a=30591-fb13f0&tap_s=1114139-605ce2' ), __( 'is one of our recommended mailers. It\'s a transactional email provider with scalable price plans, so it\'s suitable for any size of business.', 'post-smtp' ), __( 'If you\'re just starting out, you can use Brevo\'s free plan to send up to 300 emails a day. You don\'t need to use a credit card to try it out. When you\'re ready, you can upgrade to a higher plan to increase your sending limits.', 'post-smtp' ), __( 'Let\'s get started with our', 'post-smtp' ), esc_url( 'https://postmansmtp.com/documentation/sockets-addons/how-to-setup-sendinblue-aka-brevo-with-post-smtp/' ), __( 'Brevo Documentation', 'post-smtp' ) ); $html .= '
%2$s %3$s
%4$s %6$s
', esc_url( 'https://postmarkapp.com/' ), __( 'Postmark', 'post-smtp' ), __( 'is a transactional email provider that offers great deliverability and accessible pricing for any business. You can start out with the free trial that allows you to send 100 test emails each month via its secure API.', 'post-smtp' ), __( 'Let\'s get started with our', 'post-smtp' ), esc_url( 'https://postmansmtp.com/documentation/sockets-addons/postmark/' ), __( 'PostMark Documentation', 'post-smtp' ) ); $html .= '%2$s %3$s
%4$s %6$s
', esc_url( 'https://www.sparkpost.com/' ), __( 'SparkPost', 'post-smtp' ), __( 'is a transactional email provider that\'s trusted by big brands and small businesses. It sends more than 4 trillion emails each year and reports 99.9% uptime. You can get started with the free test account that lets you send up to 500 emails per month.', 'post-smtp' ), __( 'Let\'s get started with our', 'post-smtp' ), esc_url( 'https://postmansmtp.com/documentation/sockets-addons/sparkpost/' ), __( 'SparkPost Documentation', 'post-smtp' ) ); $html .= 'Elastic Email %2$s
%3$s %5$s', esc_url( 'https://elasticemail.com/' ), __( 'is a powerful transactional email platform designed to deliver exceptional performance and affordability for businesses of all sizes. which grants you the ability to send 100 test emails every month through our secure API.', 'post-smtp' ), __( 'Let\'s get started with our', 'post-smtp' ), esc_url( 'https://postmansmtp.com/documentation/sockets-addons/configure-post-smtp-with-elastic-email' ), __( 'Elastic Email Documentation', 'post-smtp' ) ); $html .= '
Mailjet %2$s
%6$s
%3$s %5$s', esc_url( 'https://app.mailjet.com/signin?redirect=aHR0cHM6Ly9hcHAubWFpbGpldC5jb20vfDI0fDgyMzU3ZDFmMWE4Y2NjMjc4ZWRhMzI0MDUzZTNlMjY0' ), __( 'is a leading email service provider that delivers a complete set of email marketing and transactional email solutions.', 'post-smtp' ), __( 'Let\'s get started with our', 'post-smtp' ), esc_url( 'https://postmansmtp.com/documentation/sockets-addons/configure-post-smtp-with-mailjet' ), __( 'Mailjet Documentation', 'post-smtp' ), __( 'Mailjet’s platform enables you to create, send, and track email marketing campaigns, transactional email messages, and email performance metrics.', 'post-smtp' ) ); $html .= '
Amazon Simple Email Service (Amazon SES) %2$s
%3$s
%4$s %6$s', esc_url( 'https://aws.amazon.com/ses/' ), __( 'a cloud-based email platform was developed by AWS to make sending and receiving emails at scale simple and effective. They also offer tools to create and send out marketing emails.', 'post-smtp' ), __( 'To use Amazon SES for your wordpress site, you must have an SSL certificate installed on your WordPress site.', 'post-smtp' ), __( 'Let’s get started with our', 'post-smtp' ), esc_url( 'https://postmansmtp.com/documentation/sockets-addons/amazon-ses-pro/' ), __( 'Amazon SES Documentation', 'post-smtp' ) ); $html .= '
%2$s %3$s
%5$s', esc_url( 'https://postmansmtp.com/extensions/office-365-extension-for-post-smtp/' ), __( 'Office 365', 'post-smtp' ), __( 'is a popular transactional email provider that sends more than 35 billion emails every month. If you\'re just starting out, the free plan allows you to send up to 100 emails each day without entering your credit card details', 'post-smtp' ), esc_url( 'https://postmansmtp.com/documentation/postman-smtp-documentation/pro-extensions/configure-office-365-integration/' ), __( 'Read how to setup Office 365', 'post-smtp' ) ); $html .= ''.__( 'Before continuing, you\'ll need to allow this plugin to send emails using your Office 365 account.', 'post-smtp' ).'
Connect to Office 365'; return $html; } /** * Render Gmail API Settings * * @since 2.7.0 * @version 1.0.0 */ public function render_zoho_settings() { $regions = array( 'com' => __( 'United States (US)', 'postsmtp-zoho' ), 'eu' => __( 'Europe (EU)', 'postsmtp-zoho' ), 'in' => __( 'India (IN)', 'postsmtp-zoho' ), 'com.cn' => __( 'China (CN)', 'postsmtp-zoho' ), 'com.au' => __( 'Australia (AU)', 'postsmtp-zoho' ), 'jp' => __( 'Japan (JP)', 'postsmtp-zoho' ), ); $selected_region = isset( $this->options_array[ ZohoMailPostSMTP\ZohoMailTransport::OPTION_REGION ] ) ? $this->options_array[ ZohoMailPostSMTP\ZohoMailTransport::OPTION_REGION ]: ''; $client_id = isset( $this->options_array[ ZohoMailPostSMTP\ZohoMailTransport::OPTION_CLIENT_ID ] ) ? $this->options_array[ ZohoMailPostSMTP\ZohoMailTransport::OPTION_CLIENT_ID ] : ''; $client_secret = isset( $this->options_array[ ZohoMailPostSMTP\ZohoMailTransport::OPTION_CLIENT_SECRET ] ) ? $this->options_array[ ZohoMailPostSMTP\ZohoMailTransport::OPTION_CLIENT_SECRET ] : ''; $required = ( isset( $_GET['success'] ) && $_GET['success'] == 1 ) ? '' : 'required'; $html = ''.sprintf( '%2$s %3$s', esc_url( 'https://www.zoho.com/mail/' ), __( 'Zoho', 'post-smtp' ), __( 'is a well-known provider of cloud-based business software and services. Zoho Corporation offers Zoho Mail, a leading email hosting and collaboration solution.', 'post-smtp' ) ).'
'; $html .= '' . __( 'Zoho Mail offers free email accounts as well as domain-specific email accounts. You can use Zoho Mail\'s API to help emails from your WordPress site deliver reliably.', 'post-smtp' ) . '
'; $html .= ''.sprintf( '%1$s %3$s', __( 'Let\'s get started with our', 'post-smtp' ), esc_url( 'https://postmansmtp.com/documentation/sockets-addons/zoho-mail-pro/' ), __( 'Zoho Mail Documentation', 'post-smtp' ) ).'
'; $html .= ''.__( 'Before continuing, you\'ll need to allow this plugin to send emails using Zoho.', 'post-smtp' ).'
Connect to Zoho'; return $html; } /** * Save Wizard | AJAX Callback * * @since 2.7.0 * @version 1.0.0 */ public function save_wizard() { $form_data = array(); parse_str( $_POST['FormData'], $form_data ); $response = false; if( isset( $_POST['action'] ) && 'ps-save-wizard' == $_POST['action'] && wp_verify_nonce( $form_data['security'], 'post-smtp' ) ) { if( isset( $form_data['postman_options'] ) && !empty( $form_data['postman_options'] ) ) { $sanitized = post_smtp_sanitize_array( $form_data['postman_options'] ); $options = get_option( PostmanOptions::POSTMAN_OPTIONS ); $_options = $options; $options = $options ? $options : array(); //for the checkboxes $sanitized['prevent_sender_email_override'] = isset( $sanitized['prevent_sender_email_override'] ) ? 1 : ''; $sanitized['prevent_sender_name_override'] = isset( $sanitized['prevent_sender_name_override'] ) ? 1 : ''; //Envelop Email Address $sanitized['envelope_sender'] = isset( $sanitized['sender_email'] ) ? $sanitized['sender_email'] : ''; //Encode API Keys $sanitized['office365_app_id'] = isset( $sanitized['office365_app_id'] ) ? $sanitized['office365_app_id'] : ''; $sanitized['office365_app_password'] = isset( $sanitized['office365_app_password'] ) ? $sanitized['office365_app_password'] : ''; $sanitized[PostmanOptions::SENDINBLUE_API_KEY] = isset( $sanitized[PostmanOptions::SENDINBLUE_API_KEY] ) ? $sanitized[PostmanOptions::SENDINBLUE_API_KEY] : ''; $sanitized['sparkpost_api_key'] = isset( $sanitized['sparkpost_api_key'] ) ? $sanitized['sparkpost_api_key'] : ''; $sanitized['postmark_api_key'] = isset( $sanitized['postmark_api_key'] ) ? $sanitized['postmark_api_key'] : ''; $sanitized['mailgun_api_key'] = isset( $sanitized['mailgun_api_key'] ) ? $sanitized['mailgun_api_key'] : ''; $sanitized[PostmanOptions::SENDGRID_API_KEY] = isset( $sanitized[PostmanOptions::SENDGRID_API_KEY] ) ? $sanitized[PostmanOptions::SENDGRID_API_KEY] : ''; $sanitized['mandrill_api_key'] = isset( $sanitized['mandrill_api_key'] ) ? $sanitized['mandrill_api_key'] : ''; $sanitized['elasticemail_api_key'] = isset( $sanitized['elasticemail_api_key'] ) ? $sanitized['elasticemail_api_key'] : ''; $sanitized[PostmanOptions::MAILJET_API_KEY] = isset( $sanitized[PostmanOptions::MAILJET_API_KEY] ) ? $sanitized[PostmanOptions::MAILJET_API_KEY] : ''; $sanitized[PostmanOptions::MAILJET_SECRET_KEY] = isset( $sanitized[PostmanOptions::MAILJET_SECRET_KEY] ) ? $sanitized[PostmanOptions::MAILJET_SECRET_KEY] : ''; $sanitized['basic_auth_password'] = isset( $sanitized['basic_auth_password'] ) ? $sanitized['basic_auth_password'] : ''; $sanitized['ses_access_key_id'] = isset( $sanitized['ses_access_key_id'] ) ? $sanitized['ses_access_key_id'] : ''; $sanitized['ses_secret_access_key'] = isset( $sanitized['ses_secret_access_key'] ) ? $sanitized['ses_secret_access_key'] : ''; $sanitized['ses_region'] = isset( $sanitized['ses_region'] ) ? $sanitized['ses_region'] : ''; $sanitized['enc_type'] = 'tls'; $sanitized['auth_type'] = 'login'; foreach( $sanitized as $key => $value ) { $options[$key] = $value; } if( $options == $_options ) { $response = true; } else { $response = update_option( PostmanOptions::POSTMAN_OPTIONS, $options ); } } } //Prevent redirection delete_transient( PostmanSession::ACTION ); wp_send_json( array(), 200 ); } /** * Redirect to Zoho Authentication * * @since 2.7.0 * @version 1.0.0 */ public function auth_zoho() { $zoho_mailer = new PostSMTP_ZohoMail(); $oauthClient = $zoho_mailer->zohomail_configuration(); $PostmanOauthClient = new ZohoMailPostSMTP\ZohoMailOauth( $oauthClient ); $state = get_transient( PostSMTP_ZohoMail::STATE ); // Save client state so we can validate in response if ( $state === false ) { $state = bin2hex( random_bytes( 32 / 2 ) ); set_transient( PostSMTP_ZohoMail::STATE, $state, 5 * MINUTE_IN_SECONDS ); } // // Generate the auth URL $redirect_url = $PostmanOauthClient->getZohoMailAuthURL( array( 'state' => $state, ) ); wp_redirect( $redirect_url ); } } new Post_SMTP_New_Wizard(); endif;