mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 23:45:54 +08:00
feat: Add logging warning when MAIL_TYPE is not set (#4771)
This commit is contained in:
parent
afed3610fc
commit
3b60b712ec
@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import resend
|
import resend
|
||||||
@ -16,7 +17,7 @@ class Mail:
|
|||||||
if app.config.get('MAIL_TYPE'):
|
if app.config.get('MAIL_TYPE'):
|
||||||
if app.config.get('MAIL_DEFAULT_SEND_FROM'):
|
if app.config.get('MAIL_DEFAULT_SEND_FROM'):
|
||||||
self._default_send_from = app.config.get('MAIL_DEFAULT_SEND_FROM')
|
self._default_send_from = app.config.get('MAIL_DEFAULT_SEND_FROM')
|
||||||
|
|
||||||
if app.config.get('MAIL_TYPE') == 'resend':
|
if app.config.get('MAIL_TYPE') == 'resend':
|
||||||
api_key = app.config.get('RESEND_API_KEY')
|
api_key = app.config.get('RESEND_API_KEY')
|
||||||
if not api_key:
|
if not api_key:
|
||||||
@ -42,6 +43,9 @@ class Mail:
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise ValueError('Unsupported mail type {}'.format(app.config.get('MAIL_TYPE')))
|
raise ValueError('Unsupported mail type {}'.format(app.config.get('MAIL_TYPE')))
|
||||||
|
else:
|
||||||
|
logging.warning('MAIL_TYPE is not set')
|
||||||
|
|
||||||
|
|
||||||
def send(self, to: str, subject: str, html: str, from_: Optional[str] = None):
|
def send(self, to: str, subject: str, html: str, from_: Optional[str] = None):
|
||||||
if not self._client:
|
if not self._client:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user