'send emails to leads and customers'

def send_emails(self):

    if self.email_sent:
        throw(_(u'Newsletter    has    already    been    sent'))
    self.recipients = self.get_recipients()
    if getattr(frappe.local, u'is_ajax', False):
        self.validate_send()
        enqueue(send_newsletter, queue=u'default', timeout=6000, event=u'send_newsletter', newsletter=self.name)
    else:
        self.queue_all()
    frappe.msgprint(_(u'Scheduled    to    send    to    {0}    recipients').format(len(self.recipients)))
    frappe.db.set(self, u'email_sent', 1)
    frappe.db.set(self, u'scheduled_to_send', len(self.recipients))
