aiosmtpd | A reimplementation of the Python stdlib smtpdpy based on asyncio | Email library
kandi X-RAY | aiosmtpd Summary
kandi X-RAY | aiosmtpd Summary
A reimplementation of the Python stdlib smtpd.py based on asyncio.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Generate a section tree
- Return the argument parser action for the given argument parser
- Import an object
- Create rst parser
- Runs pycache cleanup
- Clean out all cached files
- Remove work directories
- Deletes a directory
- Initialize environment
- Dump the environment
- Dispatch gather event
- Move prof files
- Parse command line arguments
- Argument parser
- Handle data received from the server
- Resolve the MX domain name
- Print the python interpreter details
- Get CLI options
- Dispatches the remove command
aiosmtpd Key Features
aiosmtpd Examples and Code Snippets
Community Discussions
Trending Discussions on aiosmtpd
QUESTION
I found a very perplexing issue in aiosmtpd/244, sharing my puzzlement here to help me find inspiration on how to troubleshoot.
Situation- Two servers running Red Hat 7.9
- Works on one, doesn't work on the other
- Problematic code, simplified:
ANSWER
Answered 2021-Feb-17 at 16:15Okay, so apparently I was sent on a wild goose chase.
The compounding factor is because I have suppressed ALL exceptions in these lines:
QUESTION
Im trying to create an aiosmtpd server to process emails received. It works great without authentication, yet i simply cannot figure out how to setup the authentication. I have gone through the documents and searched for examples on this.
a sample of how im currently using it:
...ANSWER
Answered 2021-Feb-16 at 15:42Alright, since you're using version 1.3.0, you can follow the documentation for Authentication.
A quick way to start is to create an "authenticator function" (can be a method in your handler class, can be standalone) that follows the Authenticator Callback guidelines.
A simple example:
QUESTION
I have been tearing my hair out at this issue
The code in question is part of an Open Source project here: aiosmtpd (my fork of the actual FOSS project, here)
The file with the problem is this one: main.py
The piece of code in which the problem happens is on line 139 of main.py
Here's a snippet:
...ANSWER
Answered 2020-Oct-15 at 07:46Barring a bug in asyncio, the issue is likely caused by a call to loop.stop()
hidden somewhere in the code base. You probably want to remove or disable those, as they are fundamentally incompatible with run_until_complete
, as well as with the more modern asyncio.run
.
QUESTION
I have a simple email server implemented using the Python language aiosmtpd
package (https://github.com/aio-libs/aiosmtpd). I also have an Apache Camel application with a route that attempts to get mail from the server.
I have been able to successfully send mail to the server, and it is being saved to a directory. However I'm running into a problem when attempting to get mail from the server. The error message from the Camel application is:
...ANSWER
Answered 2020-Apr-29 at 23:52aiosmtpd
is SMTP server. SMTP protocol is used to send, relay or forward messages, but you cannot use it to receive messages. You would need to combine your mailbox application with some implementation of IMAP
or POP3
.
QUESTION
How do I convert the following basic SMTP server that uses smtpd
to one that uses aiosmtpd
instead?
ANSWER
Answered 2017-May-11 at 02:50To translate your CustomSMTPServer into something that uses aiosmtpd, you have to define a handler class with a handle_DATA()
method that does the same thing as your process_message()
method:
QUESTION
I'm trying to run my own stmp server on my computer with python and the aiosmtpd
library.
I run the example, everything looks fine but I never receive the email on the other side.
I don't know if there are logs I can see.
I'm using visual studio 2015, python 3.5, and windows 8.1
I saw a similar post but it didn't help.
important note:
at the Client code, I also tried without the Date header
server.py:
...ANSWER
Answered 2017-May-18 at 17:53In your code, Controller(Sink(), hostname='::0', port=8025)
starts an SMTP server that receives messages on port 8025 and throws them away (the Sink()
part). That's why the messages don't show up in your inbox -- when you send an email to localhost:8025
, it is never actually sent to your inbox.
aiosmtpd is an SMTP server, meaning it will receive messages sent via SMTP and process them somehow. In your code, the Sink()
handler does not process incoming email in any way -- it simply throws incoming messages away.
If you want to send email over the Internet to bob@hate.com
, then you should contact the SMTP server responsible for the hate.com
domain instead of the SMTP server you're running using aiosmtpd. For this task you will not need to run an SMTP server, since there's supposedly already an SMTP server on the internet running for hate.com
; instead, you will need an SMTP client component, which is provided in the smtplib module in the Python standard library. Sending email with SMTP is not something that aiosmtpd is involved with in any way, and you should look for how to use smtplib instead.
Further reading: Email § Operation on Wikipedia.
QUESTION
I have the following server taken almost directly from the aiosmtpd docs:
...ANSWER
Answered 2017-Aug-01 at 20:51I was close. I figured from the fact that I could connect via telnet, but EHLO hostname
would disconnect that the server was trying to require a TLS connection ahead of time.
When I examined swaks --help
I found that there was a slightly different option that would probably do what I wanted:
QUESTION
I am trying to make an open SMTP relay using the new aiosmtpd
library that replaces smtpd
. The program below instantiates a Proxy
handler that is passed onto the mail controller, which is started afterwards in the background. A message is then created with a standard smtplib
client that connects to the relay.
All is good until the SMTP conversation between the client and the relay ends with the message never leaving the relay. The relay never replies with a 250 OK\r\n
and a ctrl+c
shows that sendmail
is waiting for a reply.
Any ideas? Is the script missing something?
Edit: mail.example.com
is only an example server. An smtpd DebuggingServer
prints nothing upon execution of the script with relay = aiosmtpd.handlers.Proxy("localhost", 1025)
.
ANSWER
Answered 2017-May-11 at 01:23EDIT: The bug has been fixed in aiosmtpd 1.0b1, so an upgrade should resolve the issue.
In aiosmtpd 1.0a4, an uncaught exception in Proxy.handle_DATA
(using data
as a str instead of bytes) causes the asyncio task to stop, but the exception is never propagated.
If you upgrade to 1.0a5 you'll get the exception printed properly: "Error: (TypeError) cannot use a string pattern on a bytes-like object". The problem is that as of 1.0a5, Proxy
in aiosmtpd is designed for use in a Controller subclass that sets decode_data=True
on the aiosmtpd.smtp.SMTP
object, but by default, decode_data=False
which causes the error. (In my opinion Proxy
should be changed to work with decode_data=False
, so I've opened PR #74.)
Thus, to use Proxy in aiosmtpd 1.0a4 or 1.0a5 you need to copy and use the UTF8Controller
subclass from aiosmtpd/tests/test_handlers.py
. I've tested the following script with both 1.0a4 and 1.0a5:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install aiosmtpd
You can use aiosmtpd like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page