'Sends an email for each response.'

def ProcessResponse(self, response):

    emails_left = self.IncrementCounter()
    if (emails_left < 0):
        return
    client_id = response.source
    client = aff4.FACTORY.Open(client_id, token=self.token)
    hostname = (client.Get(client.Schema.HOSTNAME) or 'unknown    hostname')
    client_fragment_id = urllib.urlencode((('c', client_id), ('main', 'HostInformation')))
    if (emails_left == 0):
        additional_message = (self.too_many_mails_msg % self.state.args.emails_limit)
    else:
        additional_message = ''
    subject = ('GRR    got    a    new    result    in    %s.' % self.state.source_urn)
    template_args = dict(client_id=client_id, client_fragment_id=client_fragment_id, admin_ui_url=config.CONFIG['AdminUI.url'], source_urn=self.state.source_urn, additional_message=additional_message, signature=config.CONFIG['Email.signature'], hostname=cgi.escape(utils.SmartStr(hostname)), creator=cgi.escape(utils.SmartStr(self.token.username)))
    email_alerts.EMAIL_ALERTER.SendEmail(self.state.args.email_address, 'grr-noreply', subject, (self.template % template_args), is_html=True)
