[py3] Pass bytes as "msg" to smtplib.SMTP.sendmail()
When passing a unicode string to smtplib.SMTP.sendmail() as "msg"
argument, there is an implicit bytes encoding using "ascii" encoding in
python3. Of course this does not work if the string contains non-ASCII
characters. In fact, config's sendmails method intent to pass bytes to
smtplib.SMTP.sendmail() as it uses msg.as_string() method.
Unfortunately, in python3, this method returns a unicode string whereas
it returns a bytes string in python2; we thus fix this by calling
as_bytes() method on python3.
As there is no "as_bytes" method in python2, we need to handle python2
compatibility by hand and either call as_string() or as_bytes().
In testlib, where we mock smtplib.SMTP, we need to keep the "msg"
argument of Email class (defined in testlib as well) a unicode string.
Otherwise, it fails to be parsed by email.message_from_string() (from
stdlib) if it is bytes on python3.
include README
include COPYING
include COPYING.LESSER
include pylintrc
include jshintrc
include tox.ini
include flake8-ok-files.txt
include bin/cubicweb-*
include man/cubicweb-ctl.1
recursive-include extras *.bash_completion
include doc/*.rst
include doc/*.txt
include doc/Makefile
recursive-include doc/book *
recursive-include doc/tools *.py
recursive-include doc/tutorials *.rst *.py
recursive-include doc/api *.rst
recursive-include doc/_themes *
recursive-include doc/_static *
include doc/_templates/*.html
include doc/changes/*.rst
recursive-include doc/dev *.txt *.rst
recursive-include doc/images *.png *.svg
include doc/conf.py
include cubicweb/devtools/fix_po_encoding
recursive-include cubicweb/misc *.py *.png *.display
include cubicweb/web/views/*.pt
recursive-include cubicweb/web/data *.js *.css *.py *.png *.gif *.ico *.ttf *.svg *.woff *.eot
recursive-include cubicweb/web/wdoc *.rst *.png *.xml
recursive-include cubicweb/devtools/data *.js *.css *.sh
recursive-include cubicweb/i18n *.po
recursive-include cubicweb/schemas *.py *.sql
recursive-include requirements *.txt
recursive-include cubicweb/test *.py
recursive-include cubicweb/test/data bootstrap_cubes *.py *.sql
recursive-include cubicweb/test/data-rewrite bootstrap_cubes *.py
recursive-include cubicweb/test/data_schemareader *.py
recursive-include cubicweb/dataimport/test *.py
recursive-include cubicweb/dataimport/test/data *.py *.csv *.txt
recursive-include cubicweb/dataimport/test/data-massimport *.py
recursive-include cubicweb/devtools/test *.py
recursive-include cubicweb/devtools/test/data *.py *.txt *.js *.po.ref
recursive-include cubicweb/entities/test *.py
recursive-include cubicweb/entities/test/data *.py
recursive-include cubicweb/etwist/test *.py
recursive-include cubicweb/etwist/test/data *.py
recursive-include cubicweb/ext/test *.py
recursive-include cubicweb/ext/test/data *.py
recursive-include cubicweb/hooks/test *.py
recursive-include cubicweb/hooks/test/data-computed *.py
recursive-include cubicweb/hooks/test/data *.py
recursive-include cubicweb/sobjects/test *.py
recursive-include cubicweb/sobjects/test/data bootstrap_cubes *.py
recursive-include cubicweb/server/test *.py
recursive-include cubicweb/server/test/data bootstrap_cubes *.py source* *.conf.in *.ldif
recursive-include cubicweb/server/test/data-cwep002 *.py
recursive-include cubicweb/server/test/datacomputed *.py
recursive-include cubicweb/server/test/data-schema2sql toignore
recursive-include cubicweb/server/test/data-migractions bootstrap_cubes *.py
recursive-include cubicweb/server/test/data-schemaserial *.py
include cubicweb/web/test/testutils.js
recursive-include cubicweb/web/test *.py
recursive-include cubicweb/web/test/data bootstrap_cubes pouet.css *.py
recursive-include cubicweb/web/test/data/static/jstests *.js *.html *.json
recursive-include cubicweb/wsgi/test *.py
include cubicweb/pyramid/development.ini.tmpl
include cubicweb/web/data/jquery-treeview/*.md
recursive-include cubicweb/skeleton *.py *.css *.js *.po compat *.tmpl format options pytest control
prune cubicweb/misc/cwfs
prune debian
prune cubicweb.spec