diff --git a/api/email.py b/api/email.py index 64484c1..7a5377a 100644 --- a/api/email.py +++ b/api/email.py @@ -16,12 +16,16 @@ def post_email(): name = data.get('name') phone = data.get('phone') email = data.get('email') + message = data.get('message') if not name or not phone or not email: return jsonify({"error": "Missing required fields: name, phone, email"}), 400 + if not message: + message = "Не содержит текста заявки" + # Отправляем заявку на почту - success = send_lead_to_email(name, phone, email) + success = send_lead_to_email(name, phone, email, message) if success: return jsonify({"status": "success", "message": "Lead sent successfully"}), 200 diff --git a/utils/mail.py b/utils/mail.py index 614306f..4831ddf 100644 --- a/utils/mail.py +++ b/utils/mail.py @@ -5,7 +5,7 @@ from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart -def send_lead_to_email(name, phone, email): +def send_lead_to_email(name, phone, email, diskription): """ Отправляет информацию о заявке на фиксированный email rkplastic@mail.ru. @@ -35,6 +35,7 @@ def send_lead_to_email(name, phone, email): Имя: {name} Телефон: {phone} Почта: {email} + Содержание заявки: {diskription} """ # Создаём сообщение