Serveur de messagerie Gmail

Bonjour,

Nous utilisons Gmail comme serveur de messagerie sur notre plateforme Dokos.
Nous avons paramétré Gmail pour pouvoir utiliser une “application moins sécurisée”

Toutefois, nous avons une erreur avec le log suivant :
Traceback (most recent call last):
File “/home/debian/dokos-bench/apps/frappe/frappe/utils/background_jobs.py”, line 101, in execute_job
method(**kwargs)
File “/home/debian/dokos-bench/apps/frappe/frappe/desk/doctype/notification_log/notification_log.py”, line 73, in make_notification_logs
_doc.insert(ignore_permissions=True)
File “/home/debian/dokos-bench/apps/frappe/frappe/model/document.py”, line 260, in insert
self.run_method(“after_insert”)
File “/home/debian/dokos-bench/apps/frappe/frappe/model/document.py”, line 890, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/debian/dokos-bench/apps/frappe/frappe/model/document.py”, line 1192, in composer
return composed(self, method, *args, **kwargs)
File “/home/debian/dokos-bench/apps/frappe/frappe/model/document.py”, line 1175, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/debian/dokos-bench/apps/frappe/frappe/model/document.py”, line 884, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/debian/dokos-bench/apps/frappe/frappe/desk/doctype/notification_log/notification_log.py”, line 16, in after_insert
send_notification_email(self)
File “/home/debian/dokos-bench/apps/frappe/frappe/desk/doctype/notification_log/notification_log.py”, line 97, in send_notification_email
now=frappe.flags.in_test
File “/home/debian/dokos-bench/apps/frappe/frappe/init.py”, line 533, in sendmail
inline_images=inline_images, header=header, print_letterhead=print_letterhead, with_container=with_container)
File “/home/debian/dokos-bench/apps/frappe/frappe/email/queue.py”, line 165, in send
print_letterhead=print_letterhead)
File “/home/debian/dokos-bench/apps/frappe/frappe/email/queue.py”, line 186, in add
email_queue = get_email_queue(recipients, sender, subject, **kwargs)
File “/home/debian/dokos-bench/apps/frappe/frappe/email/queue.py”, line 230, in get_email_queue
e.message = cstr(mail.as_string())
File “/home/debian/dokos-bench/apps/frappe/frappe/email/email_body.py”, line 248, in as_string
return self.msg_root.as_string(policy=policy.SMTP)
File “/usr/lib/python3.7/email/message.py”, line 158, in as_string
g.flatten(self, unixfrom=unixfrom)
File “/usr/lib/python3.7/email/generator.py”, line 116, in flatten
self._write(msg)
File “/usr/lib/python3.7/email/generator.py”, line 195, in _write
self._write_headers(msg)
File “/usr/lib/python3.7/email/generator.py”, line 222, in _write_headers
self.write(self.policy.fold(h, v))
File “/usr/lib/python3.7/email/policy.py”, line 183, in fold
return self._fold(name, value, refold_binary=True)
File “/usr/lib/python3.7/email/policy.py”, line 205, in _fold
return value.fold(policy=self)
File “/usr/lib/python3.7/email/headerregistry.py”, line 258, in fold
return header.fold(policy=policy)
File “/usr/lib/python3.7/email/_header_value_parser.py”, line 144, in fold
return _refold_parse_tree(self, policy=policy)
File “/usr/lib/python3.7/email/_header_value_parser.py”, line 2652, in _refold_parse_tree
part.ew_combine_allowed, charset)
File “/usr/lib/python3.7/email/_header_value_parser.py”, line 2729, in _fold_as_ew
first_part = to_encode[:text_space]
TypeError: slice indices must be integers or None or have an index method

Merci pour votre aide

Restant à votre disposition

Cordialement
Mathieu

Bonjour Mathieu,

J’ai l’impression que c’est la même erreur que @guillaume.augais dans le post suivant: Message-Id invalide selon RFC 2822 + encoding - #8 by guillaume.augais

C’est un problème lié à la version de python 3.7 que vous utilisez.
Il faudrait simplement mettre à jour Python3.7 vers une version plus récente ou passer sur Python 3.8

Bonne fin de journée !

1 Like