[minor] [fix] default sender in email account
This commit is contained in:
parent
f9a38c6be0
commit
3a839cb705
3 changed files with 6 additions and 3 deletions
|
|
@ -48,7 +48,7 @@ def send(recipients=None, sender=None, subject=None, message=None, reference_doc
|
|||
|
||||
if not sender or sender == "Administrator":
|
||||
email_account = get_outgoing_email_account()
|
||||
sender = email_account.get("sender") or email_account.email_id
|
||||
sender = email_account.default_sender
|
||||
|
||||
check_bulk_limit(recipients)
|
||||
|
||||
|
|
|
|||
|
|
@ -161,8 +161,7 @@ class EMail:
|
|||
self.add_attachment(name, get_pdf(html, options), 'application/octet-stream')
|
||||
|
||||
def get_default_sender(self):
|
||||
email_account = get_outgoing_email_account()
|
||||
return email.utils.formataddr((email_account.name, email_account.get("sender") or email_account.get("email_id")))
|
||||
return get_outgoing_email_account().default_sender
|
||||
|
||||
def validate(self):
|
||||
"""validate the email ids"""
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from __future__ import unicode_literals
|
|||
|
||||
import frappe
|
||||
import smtplib
|
||||
import email.utils
|
||||
import _socket
|
||||
from frappe.utils import cint
|
||||
from frappe import _
|
||||
|
|
@ -58,6 +59,9 @@ def get_outgoing_email_account(raise_exception_not_set=True, append_to=None):
|
|||
frappe.throw(_("Please setup default Email Account from Setup > Email > Email Account"),
|
||||
frappe.OutgoingEmailError)
|
||||
|
||||
email_account.default_sender = email.utils.formataddr((email_account.name,
|
||||
email_account.get("sender") or email_account.get("email_id")))
|
||||
|
||||
frappe.local.outgoing_email_account[append_to or "default"] = email_account
|
||||
|
||||
return frappe.local.outgoing_email_account[append_to or "default"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue