WordPress.org

Ready to get started?Download WordPress

Forums

wpMandrill
wpMandrill Validation Error from SB Welcome Email (3 posts)

  1. naitg
    Member
    Posted 8 months ago #

    Hi,

    Getting this error:
    wpMandrill::sendEmail: Exception Caught => wpMandrill Error: -2: Validation error: {"message":{"attachments":"Please enter an array"}}

    The error occurs when the "SB Welcome Email" plugin sends the welcome email after a new user is registered.

    Any help would be much appreciated =)

    Thanks!

    http://wordpress.org/plugins/wpmandrill/

  2. hansvandamme
    Member
    Posted 4 months ago #

    I solved it by adding an "else" branch at line 1776 in wpmadril.php, see below. I am not sure whether this a clean solution, though.

    // Checking the attachments
    if ( !empty($message['attachments']) ) {
    $message['attachments'] = self::processAttachments($message['attachments']);
    if ( is_wp_error($message['attachments']) ) {
    throw new Exception('Invalid attachment (check http://eepurl.com/nXMa1 for supported file types).');
    }
    } else {
    /*else branch added */
    $message['attachments'] = array();
    }
    /*end of else branch*/
  3. hansvandamme
    Member
    Posted 2 months ago #

    I see that the author did some modification in version 1.33 of the plugin, but this didn't solve my problem. I still had to add the else branch like this:

    // Checking attachments
                    if ( !empty($message['attachments']) ) {
                    	$message['attachments'] = self::processAttachments($message['attachments']);
                    	if ( is_wp_error($message['attachments']) ) {
                    		throw new Exception('Invalid attachment (check http://eepurl.com/nXMa1 for supported file types).');
                    	} elseif ( !is_array($message['attachments']) ) {	// some plugins return this value malformed.
                    		unset($message['attachments']);
                    	}
    
                    }
    				else {
    				/*else branch added HVD */
    				$message['attachments'] =  array();
    				}
    				/*end addition HVD*/

Reply

You must log in to post.

About this Plugin

About this Topic