markup: add send_error_email()
This commit is contained in:
@ -47,6 +47,7 @@ ProCatalog Markup Bot
|
||||
def reply(frm, subj, xls_path, pdf_path):
|
||||
msg = EmailMessage()
|
||||
msg.set_content(body_ok)
|
||||
subj = f'Re: {subj}'
|
||||
|
||||
with open(xls_path, 'rb') as fp:
|
||||
msg.add_attachment(fp.read(),
|
||||
@ -66,23 +67,28 @@ def reply(frm, subj, xls_path, pdf_path):
|
||||
def reply_missing(frm, subj):
|
||||
msg = EmailMessage()
|
||||
msg.set_content(body_missing)
|
||||
subj = f'Re: {subj}'
|
||||
send(frm, subj, msg)
|
||||
|
||||
|
||||
def reply_no_matches(frm, subj):
|
||||
msg = EmailMessage()
|
||||
msg.set_content(body_no_matches)
|
||||
subj = f'Re: {subj}'
|
||||
send(frm, subj, msg)
|
||||
|
||||
|
||||
def send_error_email(subj, einfo):
|
||||
msg = EmailMessage()
|
||||
msg.set_content(einfo)
|
||||
send('error@procatalog.io', subj, msg)
|
||||
|
||||
|
||||
def send(frm, subj, msg):
|
||||
msg['From'] = 'Keen ProCatalog Markup Bot <support@procatalog.io>'
|
||||
msg['To'] = frm
|
||||
msg['Bcc'] = 'alx-markup@procatalog.io'
|
||||
|
||||
subj = f'Re: {subj}'
|
||||
msg['Subject'] = Header(subj).encode()
|
||||
|
||||
msg['Message-ID'] = msgid()
|
||||
msg['Date'] = formatdate()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user