Updated send_to_providers.py to use the notification email_reply_to address if there is one present otherwise it uses the service email_reply_to so now users can choose a per notification email_reply_to address.

This commit is contained in:
Richard Chapman
2017-10-06 16:58:32 +01:00
parent 26d84a873e
commit b311506f37
3 changed files with 91 additions and 5 deletions

View File

@@ -28,7 +28,7 @@ from app.models import (
KEY_TYPE_NORMAL,
ServiceInboundApi,
ServiceEmailReplyTo,
ServiceLetterContact, ServiceSmsSender)
ServiceLetterContact, ServiceSmsSender, NotificationEmailReplyTo)
from app.dao.users_dao import save_model_user
from app.dao.notifications_dao import dao_create_notification, dao_created_scheduled_notification
from app.dao.templates_dao import dao_create_template
@@ -384,3 +384,21 @@ def create_letter_contact(
db.session.commit()
return letter_content
def create_reply_to_email_for_notification(
notification_id,
service,
email_address,
is_default=True
):
reply_to = create_reply_to_email(service, email_address, is_default)
notification_email_reply_to = NotificationEmailReplyTo(
notification_id=str(notification_id),
service_email_reply_to_id=str(reply_to.id)
)
db.session.add(notification_email_reply_to)
db.session.commit()
return reply_to