- Convert mail messaging from SMTP to Scaleway TEM mails
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import uuid
|
||||
from datetime import datetime as dt, timezone as tz
|
||||
from flask import request, redirect, flash, render_template, Blueprint, session, current_app
|
||||
from flask_mailman import EmailMessage
|
||||
from flask_security import roles_accepted, current_user
|
||||
from sqlalchemy.exc import SQLAlchemyError, IntegrityError
|
||||
import ast
|
||||
@@ -21,6 +20,7 @@ from common.utils.eveai_exceptions import EveAIException
|
||||
from common.utils.document_utils import set_logging_information, update_logging_information
|
||||
from common.services.tenant_services import TenantServices
|
||||
from common.services.user_services import UserServices
|
||||
from common.utils.mail_utils import send_email
|
||||
|
||||
user_bp = Blueprint('user_bp', __name__, url_prefix='/user')
|
||||
|
||||
@@ -670,20 +670,15 @@ def send_api_key_notification(tenant_id, tenant_name, project_name, api_key, ser
|
||||
}
|
||||
|
||||
try:
|
||||
|
||||
# Create email message
|
||||
msg = EmailMessage(
|
||||
msg = send_email(
|
||||
subject='Your new API-key from Ask Eve AI (Evie)',
|
||||
body=render_template('email/api_key_notification.html', **context),
|
||||
from_email=current_app.config['MAIL_DEFAULT_SENDER'],
|
||||
to=[recipient_email]
|
||||
html=render_template('email/api_key_notification.html', **context),
|
||||
to_email=recipient_email,
|
||||
to_name=recipient_email,
|
||||
)
|
||||
|
||||
# Set HTML content type
|
||||
msg.content_subtype = "html"
|
||||
|
||||
# Send email
|
||||
msg.send()
|
||||
|
||||
current_app.logger.info(f"API key notification sent to {recipient_email} for tenant {tenant_id}")
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user