Questions tagged [aiosmtpd]

aiosmtpd is an SMTP server based on asyncio. Part of the aio-libs umbrella project, aiosmtpd supersedes the old asyncore/asynchat based smtpd module in the Python standard library.

From the aiosmtpd documentation:

The Python standard library includes a basic SMTP server in the smtpd module, based on the old asynchronous libraries asyncore and asynchat. These modules are quite old and are definitely showing their age. asyncore and asynchat are difficult APIs to work with, understand, extend, and fix.

With the introduction of the asyncio module in Python 3.4, a much better way of doing asynchronous I/O is now available. It seems obvious that an asyncio-based version of the SMTP and related protocols are needed for Python 3. This project brings together several highly experienced Python developers collaborating on this reimplementation.

This package provides such a implementation of both the SMTP and LMTP protocols.

Visit the aiosmtpd GitHub repository for more information.

Use the [aiosmtpd] tag for questions and problems related to using aiosmtpd.

23 questions
30
votes
2 answers

asyncio.get_event_loop(): DeprecationWarning: There is no current event loop

I'm building an SMTP server with aiosmtpd and used the examples as a base to build from. Below is the code snippet for the entry point to the program. if __name__ == '__main__': loop = asyncio.get_event_loop() …
howley
  • 425
  • 1
  • 4
  • 5
7
votes
2 answers

How do I properly support STARTTLS with aiosmtpd?

I have the following server taken almost directly from the aiosmtpd docs: import asyncio import ssl from aiosmtpd.controller import Controller class ExampleHandler: async def handle_RCPT(self, server, session, envelope, address,…
Wayne Werner
  • 49,299
  • 29
  • 200
  • 290
5
votes
3 answers

Python aiosmtpd - what is missing for an Mail-Transfer-Agent (MTA)?

I want to write my own small mailserver application in python with aiosmtpd a) for educational purpose to better understand mailservers b) to realize my own features So my question is, what is missing (besides aiosmtpd) for an…
Franky1
  • 402
  • 6
  • 15
4
votes
1 answer

aiosmtpd - python smtp server

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…
Rafi
  • 135
  • 1
  • 9
3
votes
1 answer

python aiosmtpd server with basic authentication

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…
paulnm
  • 33
  • 3
2
votes
2 answers

How to setup minimal smtp server on localhost to send messages to other smtp servers

Honestly, I think I have a fundamental gap in understanding how SMTP works. I can't seem to find a good explanation of what is happening behind the scenes and I think this is preventing me from being able to do what I am attempting to do. To…
masq
  • 123
  • 1
  • 8
2
votes
0 answers

Dropping connections by aiosmtpd when receiving email

I am using python3, aiosmtpd to capture emails from a dvr on a private lan and strip the attachments. I've written a handler for aiosmtp and some test python to send an email with attachment, plain, no encryption and it works. When the dvr sends…
gigglerg21
  • 21
  • 2
2
votes
1 answer

Child thread can't update parent thread variable?

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: >>>…
pepoluan
  • 6,132
  • 4
  • 46
  • 76
1
vote
1 answer

Unable to send or recieve emails from python aiosmtpd SMTP server, stuck at 250 ok

I had "successfully" made an SMTP server. The code works fine connecting to SMTP clients. But it is neither able to recieve emails nor send it. I tried with various test servers and also the standard gmail/yahoo etc. Here is the code: #…
1
vote
1 answer

Python aiosmtpd gives SMTP AUTH extension not supported by server

I am trying to setup a SMTP server on my PC which should require authentication(just like gmail does). Attempting send email from client gives - "SMTP AUTH extension not supported by server". I took help from python aiosmtpd server with basic…
1
vote
2 answers

parse and decode mail text in aiosmtpd, perform string substitution, and reinject

I began with smtpd in order to process mailqueue, parse inbound emails and send them back to recipients (using smtpdlib.sendmail). I switched to aiosmtpd since i needed multithread processing (while smtpd is single-threaded, and besides that looks…
user3523425
1
vote
1 answer

Basic aiosmtpd SMTP server example

How do I convert the following basic SMTP server that uses smtpd to one that uses aiosmtpd instead? import smtpd class CustomSMTPServer(smtpd.SMTPServer): def process_message(self, peer, mailfrom, rcpttos, data): …
opsdisk
  • 21
  • 1
  • 5
0
votes
0 answers

aiosmtpd is not working on the linux version

aiosmtpd is that supported on linux versions(redhat or centos) ?, any plans ? need support on linux versions facing issue while using it on centos7 or 8 linux versions
Beno
  • 1
  • 1
0
votes
2 answers

Save email as .eml file with python

I am trying to export an Email message obtained with aiosmtpd to an *.eml file that I can later open with any *.eml viewer or email client like Thunderbird or Mail. async def handle_DATA(self, server, session, envelope) -> str: msg:…
user1618465
  • 1,813
  • 2
  • 32
  • 58
0
votes
1 answer

Can receive but not send emails with aiosmtpd SMTP server

I have setup a local SMTP server with aiosmtpd where I received emails after setting the proper DNS records: mail.mydomain.com A 1 minute 1.2.3.4 mydomain.com MX 1 minute 10 mail.mydomain.com. Just running aiosmtpd in the command line…
user1618465
  • 1,813
  • 2
  • 32
  • 58
1
2