else:
# Assume it is an email address
to[r] = None
- print to
+
for (address, name) in to.items():
if name is None:
name = (None, None)
# Don't put From and Subject in the dict, else they'll be
# present twice.
headers_dict[field] = value
- print address, name
+
msg = EmailMessage(
# Only setting the From address through headers won't set the
# envelope address right.