def __call__(self,recurrence='',base_url=''):
        """
        to use this call you may use this forms:
         http://<url_plone>/MailGenerator?base_url=<someurl>
         or
         http://<url_plone>/MailGenerator?base_url=<someurl>&recurrence=<recurrence>
        where <recurrence> is a key in RECURRENCE dictionary; base_url is the base for urls in mails 
        In the first case, all mails are generated checking if recurrence is verified. In second case only for that recurrence
        """
        self._log('Start with generation email')
        start_at=DateTime()
        pu=getToolByName(self.context,'portal_url')
        plone_site= pu.getPortalObject()

        #replace security manager to avoid any problem 
        current_sm = getSecurityManager()
        owner = plone_site.getWrappedOwner()
        newSecurityManager(None, owner)

        #get catalog
        catalog=getToolByName(self.context,'portal_catalog')

        #get valid recurrences
        valid_values=RECURRENCE.keys()
        if recurrence in valid_values:
            valid_values=[recurrence]
        else:
            valid_values=filter_recurrence_by_date(DateTime())

        #get all aggregators
        aggregators=catalog(portal_type='Aggregator')
        counter=0
        for aggr in aggregators:
            obj=aggr.getObject()
            #try to get recurrence of aggregator (default is weekly)
            if getattr(obj,'recurrence','weekly') in valid_values:
              #get send method from aggregator
              send_method=getMultiAdapter((obj,self.request),name=u'sendMail')
              #send mail and make log
              result=send_method(base_url)
              if len(result):
                  self._log(result)
                  counter+=1

        #end time
        stop_at=DateTime()
        diff=stop_at-start_at

        setSecurityManager(current_sm)

        #print reports in log
        self._log('Taked: %s'%diff)
        self._log('Generated mails: %d/%d'%(counter,len(aggregators)))
        self._log('End with generation email.')
        return "."
    def getBody(self,base_url=''):
        """ Body of mail """
        #default values
        diff=-1
        body=None

        #acquire aggregator utility from collective.plone.reader
        aggregator=self.context
        aggr_util=getMultiAdapter((self.context, self.request), name=u'aggregator_utility_view')

        #get recurrence from aggregator
        field=aggregator.getField('recurrence')
        if field:
            recurrence=field.get(aggregator)
            diff=RECURRENCE.get(recurrence,-1)

        #get contents from aggregator filtered date and limit
        date_limit=DateTime()-diff
        list_of_contents=aggr_util.getFavoritesByAggregator_not_merged(aggregator,'all',date_limit=date_limit,size_limit=10)

        #list_of_contents is a dictionary <section>: <list of contents>
        #and I want to know how many children there are
        childern=sum([len(folder['childs'])  for folder in list_of_contents.values()])

        #if there's no children we have no mail
        if childern>0:
            template=self.context.restrictedTraverse('mail_template')
            html=template(self,
                          list_of_contents=list_of_contents,
                          recurrence=LABEL_CONVERTER.get(recurrence),
                          aggregator_url=aggregator.absolute_url(),)
            #if base_url is sets we replace the url of the template
            if len(base_url)>0:
                fake_portal_path='http://foo%s'%'/'.join(self.plone_site.getPhysicalPath())
                html=html.replace(fake_portal_path,base_url)
            body = stoneagehtml.compactify(html).decode('utf-8')

        return body