4

I am trying to send email after scraping using Scrapy, but I get this error:

2017-02-25 12:44:44 [scrapy.mail] ERROR: Unable to send mail: To=['<my_email>@gmail.com'] Cc=['<my_email>@gmail.com'] Subject="Test" Attachs=0- Connection was refused by other side: 10061: No connection could be made because the target machine actively refused it..

This is the code:

    mailer = scrapy.mail.MailSender.from_settings(scrapy.conf.settings)
    mailer.send(to=["<my_email>@gmail.com"], subject="Test", 
        body="Test", cc=["<my_email>@gmail.com"])

How can I send email successfully using Scrapy MailSender()

Aminah Nuraini
  • 18,120
  • 8
  • 90
  • 108

1 Answers1

0

To send email you need an SMTP server that allows you to send email, and to configure the connection to that SMTP server through mail settings like MAIL_HOST and MAIL_PORT.

If you search the internet for the name of your email provider (e.g. Kolab Now, Google Mail) and "SMTP", you should be able to find the settings you need to use.

Gallaecio
  • 3,620
  • 2
  • 25
  • 64