I have email address list as below:
email_list = [a@gmail.com, b@gmail.com, c@gmail.com]
I converted with below:
email_string = ''.join(str(e) for e in email_list)
But I got emails are a@gmail.com b@gmail.com c@gmail.com
which can not be received email, I would like to receive email successfully(Exchange mail server).
my function is as below, I use Mailbox
of exchangelib
:
to_recipients=[Mailbox(email_address=' '.join(str(e) for e in list(test.user.all().values_list('email', flat=True))))]
You have the right idea - just use a semicolon instead of an empty string when joining:
email_string = ';'.join(str(e) for e in email_list)
# Here ---------^
While it appears that the apostrophes contain a space they actually do not.
email_string = ''.join(str(e) for e in email_list)
is different than
email_string = ' '.join(str(e) for e in email_list)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.