Giter Site home page Giter Site logo

Comments (6)

skillian avatar skillian commented on June 22, 2024

Though I'm not positive about this, my first suspicion is it might have to do with starting and stopping the loop between every call. I would recommend first moving all of your code that uses the smtp object into an async function and then passing the invocation of that function into loop.run_until_complete(my_async_function(smtp))

from aiosmtplib.

 avatar commented on June 22, 2024

Hello, thanks for your quick response.

I have the same result with this code.

async def test(smtp):
    for i in range(30):
        msg = email.message_from_string(my_eml)
        await smtp.send_message(msg)
        sleep(0.5)

loop = asyncio.get_event_loop()
smtp = aiosmtplib.SMTP(hostname='gmail-smtp-in.l.google.com', port=25, loop=loop, use_tls=False)
loop.run_until_complete(smtp.connect())
loop.run_until_complete(smtp.starttls())

loop.run_until_complete(test(smtp))
smtp.close()

Have you an idea ?

from aiosmtplib.

cole avatar cole commented on June 22, 2024

I can't reproduce error so far (testing with smtp.gmail.com). It seems like the server is dropping the connection without sending a response, but that should raise SMTPServerDisconnected.

One quick thing, for STARTTLS connections, typically the port is 587, not 25.

from aiosmtplib.

 avatar commented on June 22, 2024

Yes, the server is dropping the connection without sending a response. I encountered this issue only with gmail. So, I will catch AttributeError exception. Thank for your help.

from aiosmtplib.

cole avatar cole commented on June 22, 2024

Going to reopen this as a reminder to myself to add a test case for it.

from aiosmtplib.

cole avatar cole commented on June 22, 2024

Can't reproduce this still. Closing.

from aiosmtplib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.