title: How do I send emails to multiple people with different body?
body: <p>I want to group recipients by reason and sent out tailored emails for each reason. The data looks like this.</p>
  <pre><code>    Email              reason
  0   one@outlook.com    Address
  1   two@outlook.com    Address
  2   three@outlook.com  Phone Number
  3   one@outlook.com    Postcode
  
  import Pandas as pd
      data = { 'Email': ['one@outlook.com','two@outlook.com','three@outlook.com','one@outlook.com'],
             'reason': ['Address','Address', 'Phone Number','Postcode']}
  df = pd.DataFrame(data)
  df
  </code></pre>
  <p>This is how I started.</p>
  <pre><code>for e in df['reason'].unique():
  print(f&quot;Reason: {e}&quot;)
  print(df[df['reason'] == e]['Email'].to_list())
  print('\n')
  
  Reason: Address
  ['one@outlook.com', 'two@outlook.com']
  
  Reason: Phone Number
  ['three@outlook.com']
  
  Reason: Postcode
  ['one@outlook.com']
  </code></pre>
  <p>Not sure how to use this list below.</p>
  <pre><code>message = &quot;Update&quot; 
  email_subject = &quot;Test&quot;
  recipients = e
      
  # sending email function
  def send_mail(text, subject, recipients):
  o = win32com.client.Dispatch(&quot;Outlook.Application&quot;)
      
  Msg = o.CreateItem(0)
  Msg.to = ''
  Msg.BCC = &quot;; &quot;.join(recipients)
      
  Msg.Subject = subject
  Msg.HTMLBody = text
  Msg.Send()
      
  # sending email
  send_mail(message,email_subject,recipients)
  </code></pre>
  <p>How to set 3(or more) different email body's and loop around the grouped list to sent separate emails for each reason?</p>