+
{{ _("Verification") | e }}
diff --git a/frappe/twofactor.py b/frappe/twofactor.py
index b5ddd080f0..9e60bd6a18 100644
--- a/frappe/twofactor.py
+++ b/frappe/twofactor.py
@@ -344,30 +344,14 @@ def send_token_via_email(user, token, otp_secret, otp_issuer, subject=None, mess
hotp = pyotp.HOTP(otp_secret)
otp = hotp.at(int(token))
template_args = {"otp": otp, "otp_issuer": otp_issuer}
- if not subject:
- subject = get_email_subject_for_2fa(template_args)
- if not message:
- message = get_email_body_for_2fa(template_args)
- email_args = {
- "recipients": user_email,
- "sender": None,
- "subject": subject,
- "message": message,
- "header": [_("Verfication Code"), "blue"],
- "delayed": False,
- "retry": 3,
- }
-
- enqueue(
- method=frappe.sendmail,
- queue="short",
- timeout=300,
- event=None,
- is_async=True,
- job_name=None,
- now=False,
- **email_args,
+ frappe.sendmail(
+ recipients=user_email,
+ subject=subject or get_email_subject_for_2fa(template_args),
+ message=message or get_email_body_for_2fa(template_args),
+ header=[_("Verfication Code"), "blue"],
+ delayed=False,
+ retry=3,
)
return True