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 email_server is unhandled in test
Traceback (most recent call last):
File "/home/chnmy/workspace/frappe/benches/master-bench/apps/frappe/frappe/email/doctype/email_account/test_email_account.py", line 44, in test_unread_notification
self.test_incoming()
File "/home/chnmy/workspace/frappe/benches/master-bench/apps/frappe/frappe/email/doctype/email_account/test_email_account.py", line 35, in test_incoming
email_account.receive(test_mails=test_mails)
File "/home/chnmy/workspace/frappe/benches/master-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 291, in receive
self.handle_bad_emails(email_server, uid, msg, frappe.get_traceback())
UnboundLocalError: local variable 'email_server' referenced before assignment
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>
If you created a doc with a title longer than 140 characters, it's supposed to be truncated to 140.
However, the global search index would break for that doctype due to an error in the query.
The truncate was happening AFTER it was escaped, causing it to lose the closing quote mark which caused a SQL error and broke the index.
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>