diff --git a/addons/dine360_reservation/controllers/main.py b/addons/dine360_reservation/controllers/main.py index 9527110..b43474a 100644 --- a/addons/dine360_reservation/controllers/main.py +++ b/addons/dine360_reservation/controllers/main.py @@ -271,50 +271,61 @@ class TableReservationController(http.Controller): # Send Emails try: - company_email = request.env.company.email or 'info@chennora.ca' + import logging + _logger = logging.getLogger(__name__) + + # Use the configured outgoing mail server's FROM address (must match SMTP username) + outgoing_server = request.env['ir.mail_server'].sudo().search([], limit=1) + smtp_from = outgoing_server.smtp_user if outgoing_server else 'alaguraj0361@gmail.com' - # 1. Notify the Company + # 1. Notify the Company (Admin) admin_mail_values = { 'subject': f"New Table Reservation: {customer_name}", 'body_html': f""" -

A new table reservation has been submitted successfully.

- +
+

New Table Reservation

+

A new table reservation has been submitted from the website.

+ + + + + + +
Customer Name:{customer_name}
Phone:{phone}
Email:{email}
Number of Guests:{num_people}
Reservation Time:{start_time_str}
+
""", 'email_to': 'alaguraj0361@gmail.com', - 'email_from': company_email, + 'email_from': smtp_from, 'reply_to': email, } admin_mail = request.env['mail.mail'].sudo().create(admin_mail_values) admin_mail.send() + _logger.info("Admin reservation notification sent to alaguraj0361@gmail.com") # 2. Notify the Customer customer_mail_values = { - 'subject': f"Reservation Confirmation - Chennora", + 'subject': "Reservation Confirmation - Chennora", 'body_html': f""" -

Dear {customer_name},

-

Your table reservation has been confirmed successfully!

-

Reservation Details:

- -

If you have any questions or need to make changes, please reply to this email.

-
-

We look forward to seeing you!

-

Thank you,
Chennora

+
+

Reservation Confirmed!

+

Dear {customer_name},

+

Your table reservation at Chennora Indian Kitchen Bar has been confirmed successfully!

+ + + +
Number of Guests:{num_people}
Reservation Time:{start_time_str}
+

If you need to make any changes or have questions, please reply to this email or call us at +1(647)856-2878.

+

We look forward to seeing you!

+

Thank you,
Chennora Indian Kitchen Bar

+
""", 'email_to': email, - 'email_from': company_email, - 'reply_to': 'info@chennora.ca', + 'email_from': smtp_from, + 'reply_to': smtp_from, } customer_mail = request.env['mail.mail'].sudo().create(customer_mail_values) customer_mail.send() + _logger.info("Customer reservation confirmation sent to %s", email) except Exception as e: import logging