Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
IT Security NachrichtenTrust and the enticing consultancy offer(24.09.2026 um 20:00 Uhr)
••
Sicherheitslücken (CVE)Microsoft Upgrades SharePoint Flaw From Spoofing to 8.8 RCE(23.09.2026 um 10:01 Uhr)
••
IT Security NachrichtenLatvia Hacker Arrested Over TSC Data Theft and Extortion Attempt(24.09.2026 um 08:50 Uhr)
•
Sicherheitslücken (CVE)Apache Tomcat Update: 12 Security Flaws Fixed in Tomcat 11.0.26(24.09.2026 um 10:59 Uhr)
•
IT Security NachrichtenGroßbritannien und Kambodscha: Abkommen soll Betrugszentren bekämpfen(24.09.2026 um 19:50 Uhr)
•
IT Security NachrichtenIT Security News Hourly Summary 2026-09-24 20h : 15 posts(24.09.2026 um 20:00 Uhr)
••
Sicherheitslücken (CVE)Trust and the enticing consultancy offer(24.09.2026 um 20:02 Uhr)
•
IT Security NachrichtenTrust and the enticing consultancy offer(24.09.2026 um 20:00 Uhr)
••
Sicherheitslücken (CVE)Microsoft Upgrades SharePoint Flaw From Spoofing to 8.8 RCE(23.09.2026 um 10:01 Uhr)
••
IT Security NachrichtenLatvia Hacker Arrested Over TSC Data Theft and Extortion Attempt(24.09.2026 um 08:50 Uhr)
•
Sicherheitslücken (CVE)Apache Tomcat Update: 12 Security Flaws Fixed in Tomcat 11.0.26(24.09.2026 um 10:59 Uhr)
•
IT Security NachrichtenGroßbritannien und Kambodscha: Abkommen soll Betrugszentren bekämpfen(24.09.2026 um 19:50 Uhr)
•
IT Security NachrichtenIT Security News Hourly Summary 2026-09-24 20h : 15 posts(24.09.2026 um 20:00 Uhr)
••
Sicherheitslücken (CVE)Trust and the enticing consultancy offer(24.09.2026 um 20:02 Uhr)
•
Intelligence View
⚡ tsecurity.de Intelligence

Local Email Testing with Python and Mailpit

I'm currently building an app that automates the logistics of tech conferences. It generates certificates of participation for both attendees and speakers and also takes care of sending invitations to prospective presenters. Since it…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

I'm currently building an app that automates the logistics of tech conferences. It generates certificates of participation for both attendees and speakers and also takes care of sending invitations to prospective presenters. Since it emails multiple recipients, the question arises: in a development environment, how do you test email sending without using real accounts?



In this tutorial, you'll learn how to configure a fake SMTP server and run email tests for Python apps.






Configure a Local SMTP Server



I'm using Mailpit, an Open Source email testing tool. It can be installed following the instructions in the Installation section of the official repository, or by using Docker.



To ensure your data survives a container restart, run the Docker container with a volume to enable persistence:




docker run -d \
--name mailpit \
-p 1025:1025 \
-p 8025:8025 \
-v $(pwd)/mailpit-data:/data \
axllent/mailpit






The server listens for SMTP traffic on port 1025, while the web-based dashboard is accessible via port 8025.






Running Tests for Python



Let's create a script to test our email logic. The script will perform the following tasks:




  • Create a list of random names and emails using Faker

  • Construct MIME headers (From, To, Subject)

  • Render the HTML body

  • Establish and SMTP connection and transmit the data




  1. Create a recipient list.
    First, we generate a list of participants.




from faker import Faker

fake = Faker('en_US')

if __name__ == "__main__":
participants = [(fake.name(), fake.ascii_company_email()) for _ in range(10)]






The generated data will look like this:




Name                      | Email                         
-------------------------------------------------------
Jessica Powell | [email protected]
Chelsey Glover | [email protected]
Sheryl Williams | [email protected]
Paula Boyd | [email protected]
Maxwell Kelly | [email protected]
Carl Morrow | [email protected]
David Webb | [email protected]
Tyler Wolfe | [email protected]
Joshua Medina | [email protected]
Mrs. Donna Butler | [email protected]







  1. Construct MIME Headers
    We use Python's built-in email.mime library to structure the message.




...
from email.mime.multipart import MIMEMultipart

def send_simple_email(recipient_email, recipient_name):
SENDER_EMAIL = "[email protected]"

msg = MIMEMultipart()
msg['From'] = SENDER_EMAIL
msg['To'] = recipient_email
msg['Subject'] = f"Invitation: {recipient_name}"







  1. Render the HTML body
    We attach the HTML content to our MIME message.




...
from email.mime.text import MIMEText

def send_simple_email(recipient_email, recipient_name):
...

html_body = f"""
<html>
<body style="font-family: sans-serif;">
<h2 style="color: #2c3e50;">Hello, {recipient_name}!</h2>
<p>You are formally invited to participate as a speaker at our next event.</p>
<p>This is a test email captured locally by <strong>Mailpit</strong>.</p>
</body>
</html>
"""
msg.attach(MIMEText(html_body, 'html'))







  1. Establish SMTP connection and transmit email data
    Finally, we connect to the local Mailpit server and send the message.




import smtplib
...

def send_simple_email(recipient_email, recipient_name):
...

SMTP_SERVER = "localhost"
SMTP_PORT = 1025

try:
with smtplib.SMTP(SMTP_SERVER, SMTP_PORT) as server:
server.send_message(msg)
return True
except Exception as e:
print(f"❌ Error: {e}")
return False

if __name__ == "__main__":
...
print(f"\n📧 Starting email delivery to {len(participants)} recipients...")

for name, email in participants:
if send_simple_email(email, name):
print(f" ✅ Captured: {email}")

print("\n🚀 Check your emails at: http://localhost:8025")









The Complete Script



Here is the full implementation:




import smtplib
from faker import Faker
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

fake = Faker('en_US')

def send_simple_email(recipient_email, recipient_name):
SENDER_EMAIL = "[email protected]"

msg = MIMEMultipart()
msg['From'] = SENDER_EMAIL
msg['To'] = recipient_email
msg['Subject'] = f"Invitation: {recipient_name}"

html_body = f"""
<html>
<body style="font-family: sans-serif;">
<h2 style="color: #2c3e50;">Hello, {recipient_name}!</h2>
<p>You are formally invited to participate as a speaker at our next event.</p>
<p>This is a test email captured locally by <strong>Mailpit</strong>.</p>
</body>
</html>
"""
msg.attach(MIMEText(html_body, 'html'))

SMTP_SERVER = "localhost"
SMTP_PORT = 1025

try:
with smtplib.SMTP(SMTP_SERVER, SMTP_PORT) as server:
server.send_message(msg)
return True
except Exception as e:
print(f"❌ Error: {e}")
return False

if __name__ == "__main__":
participants = [(fake.name(), fake.ascii_company_email()) for _ in range(10)]


print(f"\n📧 Starting email delivery to {len(participants)} recipients...")

for name, email in participants:
if send_simple_email(email, name):
print(f" ✅ Sent: {email}")

print("\n🚀 Check your emails at: http://localhost:8025")









Viewing the Results



After running the script, navigate to http://localhost:8025 in your browser. You will find the Mailpit dashboard with an inbox containing all the successfully intercepted test emails.



Mailpit Dashboard



Now you can safely test email features before deploying to production.

IoC Intelligence (2 Indikatoren)
cross[.]bizmedina[.]biz
CTI Threat Relationship Graph3 Knoten / 2 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
SOC Incident Playbook: Remote Code Execution (RCE) Defense
title: Detect Exploitation - Local Email Testing with Python and Mailpit
id: ca256fee-fadc-4ec9-8890-d07e2273cedd
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-24
logsource:
  category: network_connection
  product: any
detection:
  selection:
      DestinationHostname:
        - 'cross.biz'
        - 'medina.biz'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-24"
        description = "YARA Signature for "
    strings:
        $str = "Local Email Testing with Pytho" ascii wide
    condition:
        any of them
}
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich Local Email Testing with Python and Mail.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Local Email Testing with Python and Mailpit

Thematisch verwandte Begriffe: Local, Email, Testing, with · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-57175 | Python Social Auth is a social authentication/registration mechanism. Pr…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel • Rechts: nächster Artikel • unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...
↗ Original-Quelle