Skip to content

Commit

Permalink
fix: Email tracking without "use_ssl" (#26718) (#26735)
Browse files Browse the repository at this point in the history
Everyone uses TLS these days, idk why this config exists.

closes #26717

(cherry picked from commit a65c621)

Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
mergify[bot] and ankush committed Jun 10, 2024
1 parent 38457a5 commit f78d8f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 6 additions & 1 deletion frappe/email/doctype/email_queue/email_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ def __init__(
self.sent_to_atleast_one_recipient = any(
rec.recipient for rec in self.queue_doc.recipients if rec.is_mail_sent()
)
self.email_account_doc = None

def fetch_smtp_server(self):
self.email_account_doc = self.queue_doc.get_email_account(raise_error=True)
Expand Down Expand Up @@ -325,7 +326,11 @@ def get_tracker_str(self, recipient_email) -> str:
}
tracker_url = get_url(f"{email_read_tracker_url}?{get_signed_params(params)}")

elif frappe.conf.use_ssl and self.email_account_doc.track_email_status:
elif (
self.email_account_doc
and self.email_account_doc.track_email_status
and self.queue_doc.communication
):
tracker_url = f"{get_url()}/api/method/frappe.core.doctype.communication.email.mark_email_as_seen?name={self.queue_doc.communication}"

if tracker_url:
Expand Down
5 changes: 0 additions & 5 deletions frappe/tests/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ def test_cc_header(self):
self.assertTrue("CC: test1@example.com" in message)

def test_cc_footer(self):
frappe.conf.use_ssl = True
# test if sending with cc's makes it into header
frappe.sendmail(
recipients=["test@example.com"],
Expand Down Expand Up @@ -151,10 +150,6 @@ def test_cc_footer(self):
in frappe.safe_decode(frappe.flags.sent_mail)
)

# check for email tracker
self.assertTrue("mark_email_as_seen" in frappe.safe_decode(frappe.flags.sent_mail))
frappe.conf.use_ssl = False

def test_expose(self):
from frappe.utils import set_request
from frappe.utils.verified_command import verify_request
Expand Down

0 comments on commit f78d8f8

Please sign in to comment.