Not able to send mail

File “/home/sysadmin/frappe-bench/apps/frappe/frappe/email/doctype/email_queue/email_queue.py”, line 172, in send
ctx.smtp_server.session.sendmail(
^^^^^^^^^^^^^^^^^^^^^^^
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/email/smtp.py”, line 102, in session
frappe.throw(
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/init.py”, line 645, in throw
msgprint(
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/init.py”, line 610, in msgprint
_raise_exception()
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/init.py”, line 561, in _raise_exception
raise exc

I am facing this error
How can I solve this?

Hi,

Please paste the full error log till the end, to understand the error properly.

Thanks,

Divyesh Mangroliya

[2024-08-20 05:14:57 +0000] [92152] [INFO] Worker exiting (pid: 92152)
[2024-08-20 05:14:58 +0000] [92686] [INFO] Booting worker with pid: 92686
[2024-08-20 05:17:55 +0000] [92131] [CRITICAL] WORKER TIMEOUT (pid:92686)
[2024-08-20 05:17:55 +0000] [92686] [ERROR] Error handling request /
Traceback (most recent call last):
File “/home/sysadmin/frappe-bench/env/lib/python3.12/site-packages/gunicorn/workers/sync.py”, line 135, in handle
self.handle_request(listener, req, client, addr)
File “/home/sysadmin/frappe-bench/env/lib/python3.12/site-packages/gunicorn/workers/sync.py”, line 178, in handle_request
respiter = self.wsgi(environ, resp.start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/app.py”, line 79, in application
app(environ, start_response),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/sysadmin/frappe-bench/env/lib/python3.12/site-packages/werkzeug/wrappers/request.py”, line 190, in application
resp = f(*args[:-2] + (request,))
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/app.py”, line 110, in application
frappe.handler.handle()
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/handler.py”, line 49, in handle
data = execute_cmd(cmd)
^^^^^^^^^^^^^^^^
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/handler.py”, line 85, in execute_cmd
return frappe.call(method, **frappe.form_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/init.py”, line 1768, in call
return fn(*args, **newargs)
^^^^^^^^^^^^^^^^^^^^
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/utils/typing_validations.py”, line 31, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/rate_limiter.py”, line 153, in wrapper
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py”, line 1039, in reset_password
user.reset_password(send_email=True)
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py”, line 392, in reset_password
self.password_reset_mail(link)
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py”, line 417, in password_reset_mail
self.send_login_mail(
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py”, line 482, in send_login_mail
frappe.sendmail(
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/init.py”, line 834, in sendmail
return builder.process(send_now=now)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/email/doctype/email_queue/email_queue.py”, line 732, in process
send_now and q.send()
^^^^^^^^
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/email/doctype/email_queue/email_queue.py”, line 172, in send
ctx.smtp_server.session.sendmail(
^^^^^^^^^^^^^^^^^^^^^^^
File “/home/sysadmin/frappe-bench/apps/frappe/frappe/email/smtp.py”, line 75, in session
_session = SMTP(self.server, self.port, timeout=2 * 60)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.12/smtplib.py”, line 255, in init
(code, msg) = self.connect(host, port)
^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.12/smtplib.py”, line 341, in connect
self.sock = self._get_socket(host, port, self.timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.12/smtplib.py”, line 312, in _get_socket
return socket.create_connection((host, port), timeout,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.12/socket.py”, line 837, in create_connection
sock.connect(sa)
File “/home/sysadmin/frappe-bench/env/lib/python3.12/site-packages/gunicorn/workers/base.py”, line 203, in handle_abort
sys.exit(1)
SystemExit: 1
[2024-08-20 05:17:55 +0000] [92686] [INFO] Worker exiting (pid: 92686)
[2024-08-20 05:17:55 +0000] [92734] [INFO] Booting worker with pid: 92734