lib/index.js
function(){
			var payload = { recipients: {} },
				invalid = [],
				promise = new Promise();
			for(var i=0, j=this.mails.length; i < j; i++){
				var data = this.mails[i],
					email = data.email;

					if(!data.template_id){
						invalid.push(data)
						data.error = "No template provided"
						continue;
					}

					if(typeof data.email === 'undefined'){
						invalid.push(data)
						data.error = "No email provided"
						continue;
					}


				delete data['email'];

				payload.recipients[email] = data
			}
			if(invalid.length > 0){
				promise.reject('invalid', invalid);
			}else{
				apostle.send(payload, promise);
			}
			return promise;
		}
function(){
			var payload = { recipients: {} },
				invalid = [],
				promise = new Promise();
			for(var i=0, j=this.mails.length; i < j; i++){
				var data = this.mails[i],
					email = data.email;

					if(!data.template_id){
						invalid.push(data)
						data.error = "No template provided"
						continue;
					}

					if(typeof data.email === 'undefined'){
						invalid.push(data)
						data.error = "No email provided"
						continue;
					}


				delete data['email'];

				payload.recipients[email] = data
			}
			if(invalid.length > 0){
				promise.reject('invalid', invalid);
			}else{
				apostle.send(payload, promise);
			}
			return promise;
		}
function ( ) { var payload = { recipients : { } } , invalid = [ ] , promise = new Promise ( ) ; for ( var i = 0 , j = this . mails . length ; i < j ; i ++ ) { var data = this . mails [ i ] , email = data . email ; if ( ! data . template_id ) { invalid . push ( data ) data . error = "No template provided" continue ; } if ( typeof data . email === 'undefined' ) { invalid . push ( data ) data . error = "No email provided" continue ; } delete data [ 'email' ] ; payload . recipients [ email ] = data } if ( invalid . length > 0 ) { promise . reject ( 'invalid' , invalid ) ; } else { apostle . send ( payload , promise ) ; } return promise ; }
Delivers all the emails on the queue.

@return {promise} An promise object
Delivers all the emails on the queue .