Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: update email validation regex to allow periods in local part (#10868)

Muntaser Abuzaid33cfc56ad0e5
diff --git a/api/core/tools/provider/builtin/email/tools/send_mail.py b/api/core/tools/provider/builtin/email/tools/send_mail.py
index d51d5439b78..33c040400ca 100644
--- a/api/core/tools/provider/builtin/email/tools/send_mail.py
+++ b/api/core/tools/provider/builtin/email/tools/send_mail.py
@@ -17,7 +17,7 @@ class SendMailTool(BuiltinTool):
invoke tools
"""
sender = self.runtime.credentials.get("email_account", "")
- email_rgx = re.compile(r"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$")
+ email_rgx = re.compile(r"^[a-zA-Z0-9._-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$")
password = self.runtime.credentials.get("email_password", "")
smtp_server = self.runtime.credentials.get("smtp_server", "")
if not smtp_server:
diff --git a/api/core/tools/provider/builtin/email/tools/send_mail_batch.py b/api/core/tools/provider/builtin/email/tools/send_mail_batch.py
index ff7e1769901..537dedb27d5 100644
--- a/api/core/tools/provider/builtin/email/tools/send_mail_batch.py
+++ b/api/core/tools/provider/builtin/email/tools/send_mail_batch.py
@@ -18,7 +18,7 @@ class SendMailTool(BuiltinTool):
invoke tools
"""
sender = self.runtime.credentials.get("email_account", "")
- email_rgx = re.compile(r"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$")
+ email_rgx = re.compile(r"^[a-zA-Z0-9._-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$")
password = self.runtime.credentials.get("email_password", "")
smtp_server = self.runtime.credentials.get("smtp_server", "")
if not smtp_server: