Code Monkey home page Code Monkey logo

Comments (3)

cole avatar cole commented on May 28, 2024

Not right now, but it does look very similar to SMTP. Possible we could add it in future. If you want to try to get together a PR, that might speed things up 🙂

from aiosmtplib.

dcfreire avatar dcfreire commented on May 28, 2024

I'll work on it when I get some free time.

from aiosmtplib.

dcfreire avatar dcfreire commented on May 28, 2024

I tried implementing it similarly to how python's smtplib implements it, by extending the SMTP class and changing the EHLO command to LHLO, but it doesn't deliver the email and throws.

DEBUG:asyncio:Using selector: EpollSelector
DEBUG:asyncio:Get address info localhost:24, type=<SocketKind.SOCK_STREAM: 1>
DEBUG:asyncio:Getting address info localhost:24, type=<SocketKind.SOCK_STREAM: 1> took 1.631ms: [(<AddressFamily.AF_INET6: 10>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('::1', 24, 0, 0)), (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 24))]
DEBUG:asyncio:<asyncio.TransportSocket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 46574), raddr=('127.0.0.1', 24)> connected to localhost:24: (<_SelectorSocketTransport fd=6 read=polling write=<idle, bufsize=0>>, <aiosmtplib.protocol.SMTPProtocol object at 0x7fc8ab964550>)
DEBUG:asyncio:Close <_UnixSelectorEventLoop running=False closed=False debug=True>
ERROR:asyncio:Future exception was never retrieved
future: <Future finished exception=SMTPServerDisconnected('Connection lost') created at /usr/lib/python3.10/asyncio/base_events.py:429>
source_traceback: Object created at (most recent call last):
  File "/home/shi/Documents/aiosmtplib/main.py", line 25, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1901, in _run_once
    handle._run()
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/shi/Documents/aiosmtplib/main.py", line 18, in main
    await a.send_message(message)
  File "/home/shi/Documents/aiosmtplib/aiosmtplib/smtp.py", line 1424, in send_message
    return await self.sendmail(
  File "/home/shi/Documents/aiosmtplib/aiosmtplib/smtp.py", line 1301, in sendmail
    response = await self.data(message, timeout=timeout)
  File "/home/shi/Documents/aiosmtplib/aiosmtplib/smtp.py", line 894, in data
    return await self.protocol.execute_data_command(message, timeout=timeout)
  File "/home/shi/Documents/aiosmtplib/aiosmtplib/protocol.py", line 328, in execute_data_command
    response = await self.read_response(timeout=timeout)
  File "/home/shi/Documents/aiosmtplib/aiosmtplib/protocol.py", line 271, in read_response
    self._response_waiter = self._loop.create_future()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 429, in create_future
    return futures.Future(loop=self)
aiosmtplib.errors.SMTPServerDisconnected: Connection lost

I have no idea why this happens, from what I can tell all the commands are sent correctly, but when the server replies to the data command the client abruptly disconnects. Here is the conversation that produced the error above

Connection from 127.0.0.1:52560
S: 220 localhost LMTP server ready
C: LHLO daniel-computer                                                                                                                                                                            S: S: 250-daniel-computer
S: 250-PIPELINING
S: 250 SIZE
C: MAIL FROM:<local@localhost> size=185
S: 250 OK
C: RCPT TO:<local@localhost>
S: 250 OK
C: DATA
S: 354 Start mail input; end with <CRLF>.<CRLF>
C: From: local@localhost
C: To: local@localhost
C: Subject: Hello World!
C: Content-Type: text/plain; charset="utf-8"
C: Content-Transfer-Encoding: 7bit
C: MIME-Version: 1.0
C: 
C: Sent via aiosmtplib
C: .
S: 250 OK <--- disconnects here

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.