Преглед на файлове

fix: Use email_account_doc to get track_email_status value

version-14
Suraj Shetty преди 4 години
родител
ревизия
925f1273d5
променени са 3 файла, в които са добавени 7 реда и са изтрити 2 реда
  1. +2
    -1
      frappe/email/doctype/email_account/test_records.json
  2. +1
    -1
      frappe/email/doctype/email_queue/email_queue.py
  3. +4
    -0
      frappe/tests/test_email.py

+ 2
- 1
frappe/email/doctype/email_account/test_records.json Целия файл

@@ -19,7 +19,8 @@
"unreplied_for_mins": 20, "unreplied_for_mins": 20,
"send_notification_to": "test_unreplied@example.com", "send_notification_to": "test_unreplied@example.com",
"pop3_server": "pop.test.example.com", "pop3_server": "pop.test.example.com",
"no_remaining":"0"
"no_remaining":"0",
"track_email_status": 1
}, },
{ {
"doctype": "ToDo", "doctype": "ToDo",


+ 1
- 1
frappe/email/doctype/email_queue/email_queue.py Целия файл

@@ -218,7 +218,7 @@ class SendMailContext:
'<img src="https://{}/api/method/frappe.core.doctype.communication.email.mark_email_as_seen?name={}"/>' '<img src="https://{}/api/method/frappe.core.doctype.communication.email.mark_email_as_seen?name={}"/>'


message = '' message = ''
if frappe.conf.use_ssl and self.queue_doc.track_email_status:
if frappe.conf.use_ssl and self.email_account_doc.track_email_status:
message = quopri.encodestring( message = quopri.encodestring(
tracker_url_html.format(frappe.local.site, self.queue_doc.communication).encode() tracker_url_html.format(frappe.local.site, self.queue_doc.communication).encode()
).decode() ).decode()


+ 4
- 0
frappe/tests/test_email.py Целия файл

@@ -15,6 +15,7 @@ class TestEmail(unittest.TestCase):
frappe.db.sql("""delete from `tabEmail Queue Recipient`""") frappe.db.sql("""delete from `tabEmail Queue Recipient`""")


def test_email_queue(self, send_after=None): def test_email_queue(self, send_after=None):
frappe.conf.use_ssl = True
frappe.sendmail(recipients=['test@example.com', 'test1@example.com'], frappe.sendmail(recipients=['test@example.com', 'test1@example.com'],
sender="admin@example.com", sender="admin@example.com",
reference_doctype='User', reference_name='Administrator', reference_doctype='User', reference_name='Administrator',
@@ -29,6 +30,9 @@ class TestEmail(unittest.TestCase):
self.assertTrue('test1@example.com' in queue_recipients) self.assertTrue('test1@example.com' in queue_recipients)
self.assertEqual(len(queue_recipients), 2) self.assertEqual(len(queue_recipients), 2)
self.assertTrue('<!--unsubscribe url-->' in email_queue[0]['message']) self.assertTrue('<!--unsubscribe url-->' in email_queue[0]['message'])
# check for email tracker
self.assertTrue('frappe.core.doctype.communication.email.mark_email_as_seen' in email_queue[0]['message'])
frappe.conf.use_ssl = False


def test_send_after(self): def test_send_after(self):
self.test_email_queue(send_after=1) self.test_email_queue(send_after=1)


Зареждане…
Отказ
Запис