@click.command(u'add-to-email-queue')
@click.argument(u'email-path')
@pass_context
def add_to_email_queue(context, email_path):
 site = get_site(context)
 if os.path.isdir(email_path):
  with frappe.init_site(site):
   frappe.connect()
   for email in os.listdir(email_path):
    with open(os.path.join(email_path, email)) as email_data:
     kwargs = json.load(email_data)
     kwargs[u'delayed'] = True
     frappe.sendmail(**kwargs)
     frappe.db.commit()

@ click . command ( u'add-to-email-queue' ) @ click . argument ( u'email-path' ) @ pass_context def add_to_email_queue ( context , email_path ) : site = get_site ( context ) if os . path . isdir ( email_path ) : with frappe . init_site ( site ) : frappe . connect ( ) for email in os . listdir ( email_path ) : with open ( os . path . join ( email_path , email ) ) as email_data : kwargs = json . load ( email_data ) kwargs [ u'delayed' ] = True frappe . sendmail ( ** kwargs ) frappe . db . commit ( )
add an email to the email queue .