@uses_mandrill
def clear_followup_emails_queue(email, mail_client=None):
 if (not mail_client):
  items = ScheduledJob.objects.filter(type=ScheduledJob.EMAIL, filter_string__iexact=email)
  items.delete()
  return
 for email_message in mail_client.messages.list_scheduled(to=email):
  result = mail_client.messages.cancel_scheduled(id=email_message['_id'])
  if (result.get('status') == 'error'):
   print(result.get('name'), result.get('error'))
 return

@ uses_mandrill def clear_followup_emails_queue ( email , mail_client = None ) : if ( not mail_client ) : items = ScheduledJob . objects . filter ( type = ScheduledJob . EMAIL , filter_string__iexact = email ) items . delete ( ) return for email_message in mail_client . messages . list_scheduled ( to = email ) : result = mail_client . messages . cancel_scheduled ( id = email_message [ '_id' ] ) if ( result . get ( 'status' ) == 'error' ) : print ( result . get ( 'name' ) , result . get ( 'error' ) ) return
clear out queued emails that would otherwise be sent to a specific email address .