Files
dify/api/controllers/inner_api/mail.py
T
+8 d186daa131 E-300 (#19726)
Signed-off-by: -LAN- <[email protected]>
Co-authored-by: Hash Brown <[email protected]>
Co-authored-by: crazywoola <[email protected]>
Co-authored-by: GareArc <[email protected]>
Co-authored-by: Byron.wang <[email protected]>
Co-authored-by: Joel <[email protected]>
Co-authored-by: -LAN- <[email protected]>
Co-authored-by: Garfield Dai <[email protected]>
Co-authored-by: KVOJJJin <[email protected]>
Co-authored-by: Alexi.F <[email protected]>
Co-authored-by: Xiyuan Chen <[email protected]>
Co-authored-by: kautsar_masuara <[email protected]>
Co-authored-by: achmad-kautsar <[email protected]>
Co-authored-by: Xin Zhang <[email protected]>
Co-authored-by: kelvintsim <[email protected]>
Co-authored-by: zxhlyh <[email protected]>
Co-authored-by: Zixuan Cheng <[email protected]>
2025-05-20 12:07:50 +08:00

28 lines
921 B
Python

from flask_restful import (
Resource, # type: ignore
reqparse,
)
from controllers.console.wraps import setup_required
from controllers.inner_api import api
from controllers.inner_api.wraps import enterprise_inner_api_only
from services.enterprise.mail_service import DifyMail, EnterpriseMailService
class EnterpriseMail(Resource):
@setup_required
@enterprise_inner_api_only
def post(self):
parser = reqparse.RequestParser()
parser.add_argument("to", type=str, action="append", required=True)
parser.add_argument("subject", type=str, required=True)
parser.add_argument("body", type=str, required=True)
parser.add_argument("substitutions", type=dict, required=False)
args = parser.parse_args()
EnterpriseMailService.send_mail(DifyMail(**args))
return {"message": "success"}, 200
api.add_resource(EnterpriseMail, "/enterprise/mail")