question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImportError: No module named 'twisted.mail.smtp'

See original GitHub issue

I use scrapy in python3.5, when I try to send a mail by MailSender, it’s crashed.

  File "/home/guangyao/Documents/Code/financer_crawl/env/lib/python3.5/site-packages/scrapy/mail.py", line 85, in send
    dfd = self._sendmail(rcpts, msg.as_string())
  File "/home/guangyao/Documents/Code/financer_crawl/env/lib/python3.5/site-packages/scrapy/mail.py", line 108, in _sendmail
    from twisted.mail.smtp import ESMTPSenderFactory
ImportError: No module named 'twisted.mail.smtp'

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
kmikecommented, Nov 18, 2016

@MrLokans I think you can use smtplib and email packages from standard library; see https://docs.python.org/3/library/email-examples.html. They are blocking though - it means that all processing will stop while email is waiting to be sent. So make sure sending is fast: run a local daemon (exim, postfix) and use it to send emails, so that when you call “send email” the message is put to a local queue, and then daemon handles the rest. Using e.g. gmail smtp interface directly is worse because it can be much slower.

2reactions
redapplecommented, Nov 2, 2016

@duangy , thanks for reporting. Unfortunately, Scrapy does not support sending mail with Python 3. This is actually a limitation of Twisted, which has not ported its twisted.mail module yet: see https://twistedmatrix.com/trac/ticket/8770 and https://github.com/twisted/twisted/pull/509#issuecomment-242239177

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Scrapy - No module named mail.smtp - Stack Overflow
I had same problem. installing twisted solved the problem. sudo apt-get install python-twisted.
Read more >
[Twisted-Python] Twisted.email.smtp Module ERROR
Previous message: [Twisted-Python] Twisted.email.smtp Module ERROR ... the error as import error : no module >name mail.smtp. so please someone help me to ......
Read more >
sslstrip ImportError: No module named twisted.web - Super User
I was having some difficulty installing sslstrip too. This is what worked for me. I started with a fresh copy of kali then...
Read more >
Release 22.10.0.post0 Twisted Matrix Labs
Twisted Mail Tutorial: Building an SMTP Client from Scratch . ... If it reports an error (“No module named calculus”), double check you...
Read more >
Crawl fails because folder.items is not found - Google Groups
/usr/lib/python2.6/site-packages/twisted/python/filepath.py:12: ... mail/smtp.py:10: exceptions. ... ImportError: No module named items
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found