Open febriyan1302 opened 2 years ago
Update :
i try to setup TLS with following this tutorial
and the result is :
i dont understand this logic
my code :
please help gays
Same issue???
File "/usr/lib/python3.9/smtplib.py", line 716, in login raise SMTPNotSupportedError( smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.
Hello
I have the same problem
Have you solved it
Hello
I have the same problem
Have you solved it
nope bro
Same issue???
File "/usr/lib/python3.9/smtplib.py", line 716, in login raise SMTPNotSupportedError( smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.
yes same issue
hallo @zcy382725 @l86610273
after understanding the aiosmtpd library and following this code , i solve my problem.
so, i don't need authentication
, what we need is handle_AUTH
Correct me if i am wrong
(obviously) that's the approach that I took :)
It's probably worth us improving the documentation for how to accomplish such a thing :thinking:
I'm not sure if we should create a default implementation of AUTH handling, or not, though.
Hi @febriyan1302 , where does MailProxyHandler
comes from?
In the documentation here, handle_AUTH
is mostly needed to implement a custom AUTH handling; custom AUTH mechanisms can simply implement auth_MECHANISM
callable, as described here.
A sample for a Mail Relay Proxy is provided in examples/authenticated_relayer
Hi @febriyan1302 , where does
MailProxyHandler
comes from?In the documentation here,
handle_AUTH
is mostly needed to implement a custom AUTH handling; custom AUTH mechanisms can simply implementauth_MECHANISM
callable, as described here.A sample for a Mail Relay Proxy is provided in examples/authenticated_relayer
Hi @pepoluan :) (akhirnya dibales juga sama yg punya haha, salam kenal om)
so, simply the MailProxyHandler
is a class that have function async def handle_DATA(self, server, session, envelope)
for forward mail to SMTP or API (what i need).
your sample on examples/authenticated_relayer give me error like this
and actualy i dont understand why status
return MISSING
I ran into this too when I tried to connect to an SMTP server and I think I found the root cause.
The issue / missing link is in the implementation of the ehlo
handler: https://github.com/aio-libs/aiosmtpd/blob/master/aiosmtpd/smtp.py#L833
Here the AUTH
extension is only sent if there exists a valid TLS connection. This makes sense, especially on publicly hosted services. Further checks have seen that the TLS check only works if a connection is established via STARTTLS
.
Without this no authentication support as documented in the docs is possible.
Knowing this, and explicitly initiating a connection with STARTTLS seems to work:
import smtplib, ssl
user = "test"
password = "secretpw"
# Create a secure SSL context
context = ssl.create_default_context()
sender_email = "test@example.com"
receiver_email = "receiver@example.com"
message = """\
From: test@example.com
To: receiver@example.com
Subject: Hi there
This message is sent from Python."""
with smtplib.SMTP("smtp.example.com", 568) as server:
server.helo()
server.ehlo()
server.starttls(context=context)
server.login(user, password)
server.sendmail(sender_email, receiver_email, message)
It doesn't seem to work for TLS connections which are not initiated with STARTTLS though if I read the code correctly.
你好@ zcy382725 @ l86610273
了解 aiosmtpd 库并遵循此代码后,我解决了我的问题。
所以,我不需要
authentication
,我们需要的是handle_AUTH
如果我错了,请纠正我
(obviously) that's the approach that I took :)
It's probably worth us improving the documentation for how to accomplish such a thing 🤔
I'm not sure if we should create a default implementation of AUTH handling, or not, though.
Hello Can you give your sample code thanks
examples/authenticated_relayer
from this you just need adding TLS, it works on me
SMTP Server (see tls_context)
SMTP Client
Anyone trying to use auth without TLS setup, add to Controller auth_require_tls=False
as in
hello, i'am using aiosmtpd as a server proxy mail, i want analyze traffic mail, it's normal if i'm not use Authentication, i can send a mail. but if i use authenticator on Controller my client side give me an error "SMTP AUTH extension not supported by server."
i try example of aiosmtpd/examples/authenticated_relayer/server.py , but same result.
python version : 3.6 OS : MacOS BigSur 11.5.2 , i try running on docker with base ubuntu 20.04, same result on me
Server Code :
Client Code :
Server LOG :
Client LOG :
Thank you for your help