Home > other >  Python email, why isn't the sender list one by one, but more than one
Python email, why isn't the sender list one by one, but more than one

Time:09-29

Email as follows, python, the recipient main member list, and then use a for loop turn out each hair,
The first mail is [email protected] receive,
But the second is a receipt, b also receive the
Third is a received, b received, c also received,
Why is this?
I meant I hope a received an email, receive a b, c received a

 
Try:
Member=[" [email protected] ", "[email protected]", "[email protected]"]

For to_mail member in:
A=a + 1
Subject=STR (a) + '- Python email -' + nowtime
The message [' To ']=Header (to_mail)
Message=[' Subject '] Header (Subject, 'utf-8') # mail title

STMP. Sendmail (from_addr to_mail, message. As_string ())
# print (subject, to_mail)
Print (to_mail + ', '+ STR (a) +' - email sent successfully, nowtime)
Time. Sleep (0.1)

CodePudding user response:

Don't need To traverse, the message [' To ']=Header (to_mail), to_mail received here is a list of all you have To do is To come in, do not need To traverse, can tell you the debug Header parameter types

CodePudding user response:

 
Member=[" [email protected] ", "[email protected]", "[email protected]"]
Subject=STR (a) + '- Python email -' + nowtime
The message [' To ']=Header (member)
Message=[' Subject '] Header (Subject, 'utf-8') # mail title
STMP. Sendmail (from_addr to_mail, message. As_string ())
Print (to_mail + ', '+ STR (a) +' - email sent successfully, nowtime)

CodePudding user response:

refer to the second floor MuSa xiaoxiang reply:
 
Member=[" [email protected] ", "[email protected]", "[email protected]"]
Subject=STR (a) + '- Python email -' + nowtime
The message [' To ']=Header (member)
Message=[' Subject '] Header (Subject, 'utf-8') # mail title
STMP. Sendmail (from_addr to_mail, message. As_string ())
Print (to_mail + ', '+ STR (a) +' - email sent successfully, nowtime)

I want to, the content of the different recipients to send, so need to traverse,
Everyone receive different content
  • Related