input: Write a function to send an automated email to a list of recipients. The function should take a list of emails as input, iterate over the list, and send an email to each address. If the email is successfully sent, it should print 'Email sent successfully'. If the list is empty or any error occurs, ensure that the function handles it appropriately.
  
  def send_automated_email(recipient_emails):
      sender_email = 'example@gmail.com'
      password = 'example_password'
  
      for email in recipient_emails:
          try:
              with smtplib.SMTP('smtp.gmail.com', 587) as server:
                  server.ehlo()
                  server.starttls()
                  server.login(sender_email, password)
  
                  subject = 'Automated Email from Program'
                  message = 'Message body'
                  server.sendmail(sender_email, email, 'Subject: ' + subject + '\n\n' + message)
                  print('Email sent successfully.')
          except Exception as e:
              print(f'Error sending email to {email}: {str(e)}')
  
  recipient_emails1 = ["email1@example.com", "email2@example.com"]
  recipient_emails2 = []
  recipient_emails3 = ["invalid_email"]
  
  assert send_automated_email(recipient_emails1) == None
  assert send_automated_email(recipient_emails2) == None
  assert send_automated_email(recipient_emails3) == None
output: def send_automated_email(recipient_emails):
      sender_email = 'example@gmail.com'
      password = 'example_password'
  
      if not recipient_emails:
          print('No emails to send.')
          return
  
      for email in recipient_emails:
          try:
              with smtplib.SMTP('smtp.gmail.com', 587) as server:
                  server.ehlo()
                  server.starttls()
                  server.login(sender_email, password)
  
                  subject = 'Automated Email from Program'
                  message = 'Message body'
                  server.sendmail(sender_email, email, 'Subject: ' + subject + '\n\n' + message)
                  print('Email sent successfully.')
          except Exception as e:
              print(f'Error sending email to {email}: {str(e)}')