def send_mails(mails):
 try:
  connection = get_connection()
  connection.send_messages([mail for mail in mails if (mail is not None)])
 except SMTPException as error:
  LOGGER.error(u'Failed to send email: %s', error)
  report_error(error, sys.exc_info())

def send_mails ( mails ) : try : connection = get_connection ( ) connection . send_messages ( [ mail for mail in mails if ( mail is not None ) ] ) except SMTPException as error : LOGGER . error ( u'Failed to send email: %s' , error ) report_error ( error , sys . exc_info ( ) )
sends multiple mails in single connection .