The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
replaced queue.send function with Queue builder.
Queue builder builds a queue from sendmail request and sends the mail
if requested to send mail immediately.
* Remove six for PY2 compatability since our dependencies are not, PY2
is legacy.
* Removed usages of utils from future/past libraries since they are
deprecated. This includes 'from __future__ ...' and 'from past...'
statements.
* Removed compatibility imports for PY2, switched from six imports to
standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
Usecase: Suppose I have hundred's of emails in the Email Queue and the flush job executes. While the execution of the flush job is going another flush job starts and so on. Because of this a list of flush jobs gets lined up in the background jobs queue.
To avoid this it is better to enqueue the send_one function inside the flush job this will very efficiently improve the performance of the flush job.
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>
* start of tests
* rfc compliant emails for frappe.
* fix for deepsource
* fix length of strings.
* fix bug that I'm not sure where it came from?
* codacy and deepsource issues trying to keep them happy
* take a punt in the dark
* fix: use SMTPUTF8 instead of SMTP and other minor fixes
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
so, apparently i messed up some things that were responsible for handling file attachments in email queue and attached on-the-fly generated reports. these issues should be fixed now.
Signed-off-by: Chinmay Pai <chinmaydpai@gmail.com>
The email recieved template was in unsubscribe email. Hence it
didn't used to function in case the emails were sent from DocTypes
like Issue, wherein the unsubscribe email template is not used.
Moved it to email_footer template.
Signed-off-by: Ameya Shenoy <shenoy.ameya@gmail.com>