if self._is_walking_multipart(email_index):
body = self.get_multipart_payload(decode=True)
else:
encoded_body = self._imap.uid('fetch', email_index, '(BODY[TEXT])')[1][0][1]
try:
body = decode(encoded_body, 'quopri_codec').decode('UTF-8')
except:
body = decode(encoded_body, 'quopri_codec').decode('ISO-8859-1')
return body
URLs are decoded with issues, for instance URL
<a href="https://example.com/verify-account?uid=5dd50bc5d3b1f228474551d7&t=98e1ee0c-a159-475e-a0e3-f74a533d48c8">
is decoded as
<a href="https://example.com/verify-account?uid]d50bc5d3b1f228474551d7&te1ee0c-a159-475e-a0e3-f74a533d48c8">
Here is Python code of function get_email_body():