'send mail with login details'

def send_login_mail(self, subject, template, add_args, now=None):

    from frappe.utils.user import get_user_fullname
    from frappe.utils import get_url
    mail_titles = frappe.get_hooks().get(u'login_mail_title', [])
    title = (frappe.db.get_default(u'company') or (mail_titles and mail_titles[0]) or u'')
    full_name = get_user_fullname(frappe.session[u'user'])
    if (full_name == u'Guest'):
        full_name = u'Administrator'
    args = {u'first_name': (self.first_name or self.last_name or u'user'), u'user': self.name, u'title': title, u'login_url': get_url(), u'user_fullname': full_name}
    args.update(add_args)
    sender = (((frappe.session.user not in STANDARD_USERS) and get_formatted_email(frappe.session.user)) or None)
    frappe.sendmail(recipients=self.email, sender=sender, subject=subject, template=template, args=args, header=[subject, u'green'], delayed=((not now) if (now != None) else self.flags.delay_emails), retry=3)
