-1

I wrote this function :

    def closed_handler(self, spider):
        stats = self.crawler.stats.get_stats()
        mailer = MailSender()
        mailer.send(to=["me@me.com"], subject="Scrap Ended", body="Today "+str(time.strftime("%d/%m/%Y %H:%M:%S"))+" scrap is over. Check results : "+str(stats), cc=["him@me.com"])
        log.msg("closed_handler", level=log.DEBUG)

Activated in init function like so :

    SignalManager(dispatcher.Any).connect(self.closed_handler, signal=signals.spider_closed)

It works well when I manually launch spider but once in a python egg for launching it with scrapyd, I don't receive emails anymore. I don't find any informations in scrapyd doc about email configuration nor logs which could give me a clue. Can anybody who already achieve this give feedback ? Thanks !

hugsbrugs
  • 3,501
  • 2
  • 29
  • 36

1 Answers1

-1

So everything is working fine ! what made me think there were troubles with sending mail within a python egg was the fact gmail was randomly sending some scrapy mail in spam mailbox ... as I'm using thunderbird to check my mails I couldn't see those spammy mails ... disabling spam in gmail resolved it ...

hugsbrugs
  • 3,501
  • 2
  • 29
  • 36