From f6ba0ab1adf230a3d6d722aa66c544a8b911e30a Mon Sep 17 00:00:00 2001 From: SDE Date: Fri, 23 Aug 2024 15:19:33 +0300 Subject: [PATCH] 1.6.15 split send mail to user and copy for dev --- AuthApp/js_views.py | 20 +++++++++++++++++--- AuthApp/views.py | 10 +++++++++- RoutesApp/search_matches.py | 9 ++++++++- SubscribesApp/reports.py | 10 ++++++++-- 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/AuthApp/js_views.py b/AuthApp/js_views.py index bd4556e..a18212e 100644 --- a/AuthApp/js_views.py +++ b/AuthApp/js_views.py @@ -195,7 +195,14 @@ def send_message_ajax(request): html = render_to_string('mail/m_request_offer.html', Dict, request) from BaseModels.mailSender import admin_send_mail_by_SMTPlib mail_sets = get_mail_send_options() - to = [mail_sets['sender_email'], 'web@syncsystems.net'] + to = [mail_sets['sender_email']] + res = admin_send_mail_by_SMTPlib( + mail_sets, + subject=subject, + from_email=mail_sets['sender_email'], to=to, + html_content=html + ) + to = ['web@syncsystems.net'] res = admin_send_mail_by_SMTPlib( mail_sets, subject=subject, @@ -213,7 +220,6 @@ def send_message_ajax(request): res_Dict.update(get_add_to_ajax_response_Dict(request.user)) return JsonResponse(res_Dict) - except Exception as e: return JsonResponse({ 'status': 'error', @@ -514,15 +520,23 @@ def send_check_email_after_registration(data_Dict, user): html = render_to_string('mail/m_confirm_email.html', Dict) from BaseModels.mailSender import admin_send_mail_by_SMTPlib mail_sets = get_mail_send_options() - to = [user.email, 'web@syncsystems.net', 'sa@a3-global.com', 'sysadmin.hax@gmail.com'] + to = [user.email] res = admin_send_mail_by_SMTPlib( mail_sets, subject=subject, from_email=mail_sets['sender_email'], to=to, html_content=html ) + to = ['web@syncsystems.net', 'sa@a3-global.com', 'sysadmin.hax@gmail.com'] + admin_send_mail_by_SMTPlib( + mail_sets, + subject=subject, + from_email=mail_sets['sender_email'], to=to, + html_content=html + ) return res + except Exception as e: print(f'send_registration_mail Error = {str(e)}') return None diff --git a/AuthApp/views.py b/AuthApp/views.py index 8182a29..f5f66ea 100644 --- a/AuthApp/views.py +++ b/AuthApp/views.py @@ -37,15 +37,23 @@ def send_registration_mail(user): html = render_to_string('mail/m_registration.html', Dict) from BaseModels.mailSender import admin_send_mail_by_SMTPlib mail_sets = get_mail_send_options() - to = [user.email, 'web@syncsystems.net', 'sa@a3-global.com', 'sysadmin.hax@gmail.com'] + to = [user.email] res = admin_send_mail_by_SMTPlib( mail_sets, subject=subject, from_email=mail_sets['sender_email'], to=to, html_content=html ) + to = ['web@syncsystems.net', 'sa@a3-global.com', 'sysadmin.hax@gmail.com'] + admin_send_mail_by_SMTPlib( + mail_sets, + subject=subject, + from_email=mail_sets['sender_email'], to=to, + html_content=html + ) return res + except Exception as e: print(f'send_registration_mail Error = {str(e)}') return None diff --git a/RoutesApp/search_matches.py b/RoutesApp/search_matches.py index 4342804..85713cb 100644 --- a/RoutesApp/search_matches.py +++ b/RoutesApp/search_matches.py @@ -59,7 +59,7 @@ def send_mail_found_matches_routes(route, data_Dict): mail_sets = get_mail_send_options() - to = [route.owner.email, 'web@syncsystems.net'] + to = [route.owner.email] subject = _('Мы нашли исполнителя по Вашему объявлению!') res = admin_send_mail_by_SMTPlib( mail_sets, @@ -67,6 +67,13 @@ def send_mail_found_matches_routes(route, data_Dict): from_email=mail_sets['sender_email'], to=to, html_content=html ) + to = ['web@syncsystems.net'] + res = admin_send_mail_by_SMTPlib( + mail_sets, + subject=subject, + from_email=mail_sets['sender_email'], to=to, + html_content=html + ) return res diff --git a/SubscribesApp/reports.py b/SubscribesApp/reports.py index 2747462..33c7ccf 100644 --- a/SubscribesApp/reports.py +++ b/SubscribesApp/reports.py @@ -30,7 +30,7 @@ def send_mail_for_user_subscribes_that_is_going_to_finish(): html = render_to_string('mail/m_user_subscribes_that_is_going_to_finish.html', Dict) from BaseModels.mailSender import admin_send_mail_by_SMTPlib mail_sets = get_mail_send_options() - to = [user_subscribe.user.email, 'web@syncsystems.net', 'sa@a3-global.com', 'sysadmin.hax@gmail.com'] + to = [user_subscribe.user.email] res = admin_send_mail_by_SMTPlib( mail_sets, subject=subject, @@ -40,7 +40,13 @@ def send_mail_for_user_subscribes_that_is_going_to_finish(): if res and type(res) == str: print(res) # log += f'\n{res}' - + to = ['web@syncsystems.net', 'sa@a3-global.com', 'sysadmin.hax@gmail.com'] + admin_send_mail_by_SMTPlib( + mail_sets, + subject=subject, + from_email=mail_sets['sender_email'], to=to, + html_content=html + ) except Exception as e: msg = (f'send_mail_for_user_subscribes_that_is_going_to_finish '