• Hi,

    We have detected that for some months the pluguin stopped sending MailPoet confirmation mail.

    After analyzing the situation we have seen that the problem comes from the file: /wp-content/plugins/add-on-gravity-forms-mailpoet/class-gfnewmailpoetaddon.php

    The process_feed function try to add the subscriber and check if there the subsriber exists analyzing the exception thrown by the addSubscriber method (L82 – L228):

    
        /**
         * Add subscriber info to the desired lists when submission is complete.
         */
        public function process_feed( $feed, $entry, $form ) {
    
     
            ..............
    
            try {
                $subscriber_data = \MailPoet\API\API::MP( 'v1' )->addSubscriber( $subscriber_data, $mailpoetlists,
                    $options );
     
            } catch ( Exception $exception ) {
     
                if ( 'This subscriber already exists.' == $exception->getMessage() ) {
    
                    try {
                        if ($skipEmailValidation) {
                            $subscriber_data['status']          = 'subscribed';
                            Subscriber::createOrUpdate( $subscriber_data );
                        }
                        else {
                            $subscriber_data['status']          = 'unconfirmed';
                            Subscriber::createOrUpdate( $subscriber_data );
                            $subscriber = \MailPoet\API\API::MP( 'v1' )->subscribeToLists( $subscriber_data['email'], $mailpoetlists, $options['send_confirmation_email'] = true );
                        }
     
     
                    } catch ( Exception $exception ) {
     
                    }
     
                } else {
     
                }
            }
        }
    

    The problem is that if you use MailPoet in a language that is not english, the exception message is translated and the code won’t run as intended!!!

    MailPoet documentation states that they return special code depending of the type of error:
    https://github.com/mailpoet/mailpoet/blob/master/doc/api_methods/AddSubscriber.md

    So, this problem can be corrected changing line 206 from
    if ( 'This subscriber already exists.' == $exception->getMessage() ) {
    to
    if ( 12 == $exception->getCode() ) {

    We have patched our plugin with success and the plugin is now running correctly.

    Hope you can include the fix in a future release!

    Regards,

    Jonathan

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    Thanks for reporting and the patch. We will release a fix soon.

    Thank you

    Hi!

    This issue is also happening in the file: /wp-content/plugins/add-on-gravity-forms-mailpoet/add-on-gravity-forms-mailpoet.php

    The process_mailpoet_list function try to add the subscriber and check if there the subsriber exists analyzing the exception thrown by the addSubscriber method (L264 – L449):

    
    /**
     * Process form submission, make subscriber, etc.
     */
    add_action( 'gform_after_submission', 'process_mailpoet_list', 10, 2 );
    function process_mailpoet_list( $entry, $form ) 
    
            ..............
    
    try {
    			$subscriber_data = \MailPoet\API\API::MP( 'v1' )->addSubscriber( $subscriber_data, $mailpoetlists );
    
    		} catch ( Exception $exception ) {
    
    			if ( 'This subscriber already exists.' == $exception->getMessage() ) {
    				try {
    					$subscriber_data['status']          = 'unconfirmed';
    					Subscriber::createOrUpdate( $subscriber_data );
    					$subscriber = \MailPoet\API\API::MP( 'v1' )->subscribeToLists( $subscriber_data['email'], $mailpoetlists, $options['send_confirmation_email'] = true );
    
    				} catch ( Exception $exception ) {
    
    				}
    
    			} else {
    
    			}
    		}
    

    The solution provided by @jpasquier also works here :)!

    This is not working for me. I have tried with the added codes above. Thanks for sharing.

    Hello,

    Thanks for reporting and the patch. We will release a fix soon.

    Thank you

    Has this problem been fixed already? I stopped using the plugin because of this happening. Looks like the plugins has not been updated for a while.

    I need a solution for another project now. I wonder if this plugins is still a reliable solution? Is the plugin still supported? Or does anyone now an alternative? (I don’t mind if its a premium solution.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Patch – Email confirmation not sent’ is closed to new replies.