input: Write a function to send an automated email to a list of recipients by iterating over the list and sending an email to each address. The function should use an SMTP server to connect and send emails. If the email is sent successfully, print "Email sent successfully.".
  assert send_automated_email(["email1@example.com","email2@example.com"])==None
  assert send_automated_email([])==None
output: def send_automated_email(recipients):
      import smtplib
      from email.mime.text import MIMEText
      from email.mime.multipart import MIMEMultipart
  
      sender_email = "your_email@example.com"
      sender_password = "your_password"
      smtp_server = "smtp.example.com"
      smtp_port = 587
  
      for recipient in recipients:
          message = MIMEMultipart()
          message['From'] = sender_email
          message['To'] = recipient
          message['Subject'] = "Automated Email"
          body = "This is an automated email."
          message.attach(MIMEText(body, 'plain'))
  
          try:
              server = smtplib.SMTP(smtp_server, smtp_port)
              server.starttls()
              server.login(sender_email, sender_password)
              server.sendmail(sender_email, recipient, message.as_string())
              server.quit()
              print("Email sent successfully.")
          except Exception as e:
              print(f"Failed to send email to {recipient}: {e}")