Merge pull request #796 from anandpdoshi/anand-august-27

Append X-Frappe-Site header in outgoing email
This commit is contained in:
Pratik Vyas 2014-08-27 15:14:47 +05:30
commit e00286a93d
2 changed files with 12 additions and 8 deletions

View file

@ -1,20 +1,20 @@
{
"db_name": "testdb",
"db_name": "testdb",
"db_password": "password",
"mute_emails": true,
"developer_mode": 1,
"auto_cache_clear": true,
"disable_website_cache": true,
"max_file_size": 1000000,
"mail_server": "localhost",
"mail_login": null,
"mail_password": null,
"mail_port": 25,
"use_ssl": 0,
"auto_email_id": "hello@example.com",
"google_login": {
"client_id": "google_client_id",
"client_secret": "google_client_secret"
@ -27,8 +27,9 @@
"client_id": "facebook_client_id",
"client_secret": "facebook_client_secret"
},
"celery_broker": "redis://localhost",
"celery_result_backend": null,
"scheduler_interval": 300
}
"scheduler_interval": 300,
"celery_queue_per_site": true
}

View file

@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe import msgprint, throw, _
from frappe.utils import scrub_urls
from frappe.utils import scrub_urls, get_url
from frappe.utils.pdf import get_pdf
import email.utils
from markdown2 import markdown
@ -193,6 +193,9 @@ class EMail:
if self.cc:
self.msg_root['CC'] = ', '.join([r.strip() for r in self.cc]).encode("utf-8")
# add frappe site header
self.msg_root.add_header(b'X-Frappe-Site', get_url().encode('utf-8'))
def as_string(self):
"""validate, build message and convert to string"""
self.validate()