fixes issue where previous communication has no attribute _attachments
before it fails, causing the following error:
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 99, in execute_job
method(**kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 724, in pull_from_email_account
email_account.receive()
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 295, in receive
attachments = [d.file_name for d in communication._attachments]
AttributeError: 'Communication' object has no attribute '_attachments'
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
fixes issue where smtplib fails to encode the mail as ascii
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 60, in application
response = frappe.api.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/api.py", line 55, in handle
return frappe.handler.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 22, in handle
data = execute_cmd(cmd)
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 61, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1042, in call
return fn(*args, **newargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py", line 801, in reset_password
user.reset_password(send_email=True)
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py", line 234, in reset_password
self.password_reset_mail(link)
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py", line 253, in password_reset_mail
"password_reset", {"link": link}, now=True)
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py", line 298, in send_login_mail
delayed=(not now) if now!=None else self.flags.delay_emails, retry=3)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 476, in sendmail
inline_images=inline_images, header=header, print_letterhead=print_letterhead)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/queue.py", line 162, in send
print_letterhead=print_letterhead)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/queue.py", line 185, in add
send_one(email_queue.name, now=True)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/queue.py", line 475, in send_one
raise e
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/queue.py", line 415, in send_one
smtpserver.sess.sendmail(email.sender, recipient.recipient, message)
File "/usr/lib64/python3.6/smtplib.py", line 855, in sendmail
msg = _fix_eols(msg).encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 335-339: ordinal not in range(128)
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
mail status wasn't being set when the check was run, so the output for
any() would always be false, and none of the mails would have status set
to sent in the backend. moving the check to a point after setting status
for each email should fix this issue
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
apparently, since version 2.8, psycopg2 does not install the binary
version by default (read source), and hence fails on setup with the
error:
Error: pg_config executable not found
since nobody can really be arsed to compile this binary on their own,
we'll stick to using psycopg2-binary instead.
source: https://www.postgresql.org/message-id/CA%2Bmi_8bd6kJHLTGkuyHSnqcgDrJ1uHgQWvXCKQFD3tPQBUa2Bw%40mail.gmail.com
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>