Zum Hauptinhalt springen
LIVE
CVSS 8.7CVE-2026-138346 | In Y Soft SAFEQ Cloud PC Client for Windows and macOS before 2026.09.03.4, under specific conditions, an attacker who already has access to a workstation running the PC Client, and who has specific knowledge of the customer's environment and the targeted workstation, could access files on another workstation running the PC Client within the same organization, including locally stored print jobs (local storage or hybrid mode). Access from outside the customerCVSS 9.4CVE-2026-138199 | A vulnerability was found in D-Link DIR-629 1.03.B01 CN. This affects the function dhcps4start of the file /etc/services/DHCPS/dhcpserver.php of the component DHCP Server. The manipulation of the argument domain results in os command injection. The attack may be performed from remote. The exploit has been made public and could be used.CVSS 5.3CVE-2026-138170 | A security flaw has been discovered in itsourcecode Event Management System 1.0. This issue affects some unknown processing of the file /admin/view_event.php. Performing a manipulation of the argument ID results in sql injection. The attack may be initiated remotely. The exploit has been released to the public and may be used for attacks.CVSS 5.1CVE-2026-138169 | A vulnerability was identified in itsourcecode Insurance Management System 1.0. This vulnerability affects unknown code of the file updateNominee.php. Such manipulation of the argument nominee_id leads to sql injection. The attack can be launched remotely. The exploit is publicly available and might be used.CVSS 5.3CVE-2026-138168 | A vulnerability was determined in itsourcecode Insurance Management System 1.0. This affects an unknown part of the file updateClient.php. This manipulation of the argument client_id causes sql injection. The attack can be initiated remotely. The exploit has been publicly disclosed and may be utilized.CVSS 4.8CVE-2026-138167 | A vulnerability was found in OpenHands software-agent-sdk up to 1.64.1. Affected by this issue is the function FileSettingsStore.load of the file openhands/agent_server/persistence/store.py of the component agent_server. The manipulation results in incorrect authorization. Attacking locally is a requirement. The exploit has been made public and could be used.CVSS 6.9CVE-2026-138166 | A vulnerability has been found in wxiaoqi Spring-Cloud-Platform up to 3.0. Affected by this vulnerability is the function RsaKeyHelper.generateKey of the file ace-modules/ace-admin/src/main/resources/application.yml of the component JWT Authentication. The manipulation of the argument rsa-secret leads to use of hard-coded cryptographic key . It is possible to initiate the attack remotely. The exploit has been disclosed to the public and may be used. The proCVSS 10.0CVE-2026-138165 | A flaw has been found in D-Link R15 up to 1.22. Affected is an unknown function of the file /flupl/nodered of the component Upload Handler. Executing a manipulation of the argument filename can lead to os command injection. The attack may be performed from remote. The exploit has been published and may be used.
Alle im Drawer
Intelligence View
⚡ tsecurity.de Intelligence

Building a Transactional Email CLI with Mailgun and Python

If your app needs to send a welcome email, a password reset link, or an order confirmation, you don't need to stand up a mail server. You need one HTTP call.…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Quelle & Fakten · 7 Min. Lesezeit
Quelle: dev.to
Rubrik: Sichere Programmierung

If your app needs to send a welcome email, a password reset link, or an order confirmation, you don't need to stand up a mail server. You need one HTTP call.



This tutorial builds a small Python CLI that sends transactional email through Mailgun's API, then checks whether Mailgun actually delivered it. By the end, you'll have replaced "sending email" with a simpler model: call an API, read the response, done.






What you need before starting



Before you start, gather the following:




  • Basic Python knowledge.

  • Python installed.

  • A Mailgun account (the free tier works).

  • The requests library (pip install requests).






What you'll build



The app is a small CRUD tool with four actions:




  • Send an email.

  • List what's been sent.

  • Check delivery status.

  • Delete a record.



Two files do the real work:





  • mailgun_client.py — the only file that talks to Mailgun; it sends emails and checks their status.


  • storage.py — logs each sent email to a local JSON file, so there's something to check later.



main.py wires these two together into a menu, and config.py loads your Mailgun credentials. Neither file does anything Mailgun-specific. This tutorial moves through them quickly and spends most of its time on mailgun_client.py, where the real subject lives.






Set up your Mailgun account



Sign up for a free Mailgun account. Every account starts with a sandbox domain — a Mailgun-provided domain you can send test emails from immediately, without verifying your own domain's DNS records.



Grab two things from the dashboard, both under Sending → Domain settings:




  • Your domain (the sandbox domain, e.g. sandboxXXXX.mailgun.org, or your own verified domain)

  • Your API key



One sandbox-specific rule catches people the first time: sandbox domains only deliver to authorized recipients. Before you can send yourself a test email, add your own address under Authorized Recipients in the dashboard. Skip this step, and Mailgun accepts the request but never delivers it — exactly the silent failure the status-check step later in this tutorial is built to catch.






Configure your credentials



Store your API key, domain, and sender address as environment variables — never in code. config.py loads them with a small dotenv reader (no extra dependencies), then fails fast if anything's missing:




MAILGUN_API_KEY = os.environ.get("MAILGUN_API_KEY")
MAILGUN_DOMAIN = os.environ.get("MAILGUN_DOMAIN")
MAILGUN_SENDER = os.environ.get("MAILGUN_SENDER")
MAILGUN_BASE_URL = os.environ.get("MAILGUN_BASE_URL", "https://api.mailgun.net/v3")






MAILGUN_BASE_URL defaults to Mailgun's US host. If your account is on Mailgun's EU region, set this to https://api.eu.mailgun.net/v3 instead — worth knowing before a mismatched region costs you a confusing 401.



With MAILGUN_API_KEY, MAILGUN_DOMAIN, and MAILGUN_SENDER set in a .env file, the app is ready to talk to Mailgun.






Send the email



This function delivers on the tutorial's promise. Everything before it was setup; everything after it is bookkeeping.




def send_email(to, subject, body, sender):
response = requests.post(
f"{MAILGUN_BASE_URL}/{MAILGUN_DOMAIN}/messages",
auth=("api", MAILGUN_API_KEY),
data={
"from": sender,
"to": to,
"subject": subject,
"text": body,
},
)
response.raise_for_status()
return response.json()






A transactional email, structurally, is four fields: from, to, subject, text. Mailgun's Messages API takes exactly those four as form fields on a POST to /{domain}/messages. There's no envelope object, no MIME construction, no SMTP handshake — you build a dictionary and make one request.



Two details here are easy to get wrong the first time:





  • Auth is HTTP Basic Auth, not a bearer token. The username is the literal string "api"; your API key is the password. requests handles the encoding through the auth= tuple — but if you're used to APIs that expect Authorization: Bearer <token>, this is a different shape.


  • The payload is form-encoded, not JSON. data={...} sends application/x-www-form-urlencoded, which is what Mailgun's Messages API expects — even though the response comes back as JSON. Passing json= here instead of data= is a common first mistake, and the resulting error doesn't make the cause obvious.



response.raise_for_status() turns a 4xx or 5xx response into a Python exception immediately, instead of letting a failed send look successful. response.json() hands back Mailgun's confirmation, including a message ID — the thread that connects sending an email to checking on its delivery later.






Confirm the email actually delivered



Here's the detail that matters most: Mailgun accepting your request is not the same as Mailgun delivering your email. A 200 response means "I've queued this to send," not "your recipient has it." Confirming delivery means asking Mailgun a second, separate question.



Mailgun doesn't expose a "get status by message ID" endpoint. Instead, you query its Events API — a log of everything that's happened to your domain's messages — and filter by ID:




def get_delivery_status(message_id):
clean_id = message_id.strip("<>")

response = requests.get(
f"{MAILGUN_BASE_URL}/{MAILGUN_DOMAIN}/events",
auth=("api", MAILGUN_API_KEY),
params={"message-id": clean_id},
)
response.raise_for_status()
events = response.json().get("items", [])

if not events:
return "unknown"

return events[0].get("event", "unknown")






Two quirks are worth knowing before you hit them:




  • The message ID send_email() returns is wrapped in angle brackets (<abc123@sandbox...mailgun.org>), but the Events filter expects the bare ID. strip("<>") handles the mismatch.

  • The event log can lag a few seconds behind the send. Check status immediately after sending, and you may get "unknown" back — not because anything failed, but because Mailgun hasn't logged the event yet. Waiting a moment and checking again usually resolves it.



events[0] is the most recent event for that message — typically delivered, accepted, or failed. That single string is confirmation that the email didn't just leave your app; it actually arrived.






Wire the send and status functions into the app



main.py calls these two functions and logs the result. The send step looks like this:




result = mailgun_client.send_email(
to=to, subject=subject, body=body, sender=config.MAILGUN_SENDER,
)
record = storage.create_record({
"to": to,
"mailgun_message_id": result["id"],
"status": "queued",
# ...
})






storage.py writes that record to a local JSON file — not because Mailgun requires it, but because Mailgun doesn't keep "your" list of sent emails, only a raw event log. The local record is what lets you look up a message ID later and ask get_delivery_status() about it.






Run the app






$ python main.py
--- Mailgun Transactional Email Manager ---
1. Send a new email (Create)
2. List logged emails (Read)
3. Refresh delivery status (Update)
4. Delete a logged email (Delete)
5. Quit
Choose an option: 1
Recipient email: you@example.com
Subject: Test send
Body text: Hello from the Mailgun API.

Sent. Local record #1 created. Mailgun says: Queued. Thank you.






Choose option 3 and enter 1, and the app queries the Events API and updates the record — queued becomes delivered (or accepted, depending on timing). If it still shows unknown, wait a few seconds and check again; that's the event-log lag, not a bug.






Treat sending email as an API call



Nowhere in this project is there SMTP configuration, a mail server, or a queuing system to install. There's one POST to send an email and one GET to confirm it arrived — both plain HTTP calls made with requests.



That's the mental model worth keeping: sending email from an app isn't a mail-server problem. It's an API call.



The repository for the code link : https://github.com/anthonyonyenaobijeffery-debug/Sending-Transactional-Emails-in-Python-with-Mailgun

Information ergänzen Fachhinweis, Update, Korrektur oder Quelle zur Meldung beitragen
Gäste-Hinweise werden kurz redaktionell geprüft und danach hier angezeigt.

Community-Hinweise zur Meldung

0 freigegeben
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!
Informations-Bewertung:

💬 Community-Diskussion & Kommentare

🌐 Zum Hauptchat

Starte die Diskussion im Social-Chat Broadcast Stream oder reiche oben über „Information ergänzen“ einen Fachbeitrag ein.

Community Rating &amp; Social Proof
⭐ Leser-Wertung
–
Ø / 5.0
Noch keine Leser-Bewertungen
War dieser Artikel hilfreich?
0
Jetzt Bewertung abgeben
Detail-Bewertung (optional)
Inhalt & Qualität
Quelle & Glaubwürdigkeit
Aktualität
Security Briefing Kostenlos · 1-Klick-Abmeldung

Intelligence Digest — kostenlos

Täglich die wichtigsten Security-News · jederzeit abbestellbar

Verwandte Story-Cluster & Quellen (Vektor-KI)

6 Cluster
23 Quellen
CVE-2026-135540 | Mozilla Firefox up to 115.45/153.7/160 JIT memory corruption (Nessus ID 388625)
VulDB Updates vor 2 Std.
22 weitere Quellen
VulDB Updatesvor 2 Std.CVE-2026-135539 | Mozilla Firefox up to 115.45/153.7/160 CSS Object Model use after free (Nessus ID 388625) VulDB Updatesvor 2 Std.CVE-2026-135542 | Mozilla Firefox up to 115.45/153.7/160 Layout buffer overflow (Nessus ID 388625) VulDB Updatesvor 2 Std.CVE-2026-135541 | Mozilla Firefox up to 115.45/153.7/160 XSLT use after free (Nessus ID 388625) VulDB Updatesvor 2 Std.CVE-2026-135544 | Mozilla Firefox up to 115.45/153.7/160 Navigation memory corruption (Nessus ID 388625) VulDB Updatesvor 2 Std.CVE-2026-135545 | Mozilla Firefox up to 153.7/160 Editor memory corruption (Nessus ID 388625) VulDB Updatesvor 2 Std.CVE-2026-135543 | Mozilla Firefox up to 115.45/153.7/160 Networking memory corruption (Nessus ID 388625) VulDB Updatesvor 2 Std.CVE-2026-135547 | Mozilla Firefox up to 115.45/153.7/160 Networking sandbox (Nessus ID 388625) VulDB Updatesvor 2 Std.CVE-2026-135549 | Mozilla Firefox up to 115.45/153.7/160 XSLT use after free (Nessus ID 388625) VulDB Updatesvor 2 Std.CVE-2026-135548 | Mozilla Firefox up to 115.45/153.7/160 Layout use after free (Nessus ID 388625) VulDB Updatesvor 3 Std.CVE-2026-135533 | Mozilla Firefox up to 115.45/153.7/160 Layout Tables off-by-one (Nessus ID 388625) VulDB Updatesvor 3 Std.CVE-2026-135536 | Mozilla Firefox up to 115.45/153.7/160 DOM Editor uninitialized pointer (Nessus ID 388625) VulDB Updatesvor 3 Std.CVE-2026-135535 | Mozilla Firefox up to 115.45/153.7/160 Skia input validation (Nessus ID 388625) VulDB Updatesvor 3 Std.CVE-2026-135537 | Mozilla Firefox up to 115.45/153.7/160 Layout Text/Fonts out-of-bounds (Nessus ID 388625) VulDB Updatesvor 3 Std.CVE-2026-135525 | Mozilla Firefox up to 115.45/153.7/160 WebRender use after free (Nessus ID 388625) VulDB Updatesvor 3 Std.CVE-2026-135526 | Mozilla Firefox up to 115.45/153.7/160 Networking use after free (Nessus ID 388625) VulDB Updatesvor 3 Std.CVE-2026-135527 | Mozilla Firefox up to 115.45/153.7/160 DOM/HTML use after free (Nessus ID 388625) VulDB Updatesvor 3 Std.CVE-2026-135528 | Mozilla Firefox up to 153.7/160 HTTP race condition (Nessus ID 388625) VulDB Updatesvor 3 Std.CVE-2026-135530 | Mozilla Firefox up to 115.45/153.7/160 HTTP sandbox (Nessus ID 388625) VulDB Updatesvor 3 Std.CVE-2026-135529 | Mozilla Firefox up to 153.7/160 Text sandbox (Nessus ID 388625) VulDB Updatesvor 3 Std.CVE-2026-135520 | Mozilla Firefox up to 115.45/153.7/160 CanvasWebGL sandbox (Nessus ID 388625) VulDB Updatesvor 3 Std.CVE-2026-135524 | Mozilla Firefox JavaScript Engine use after free (Nessus ID 388625) VulDB Updatesvor 3 Std.CVE-2026-135521 | Mozilla Firefox up to 115.45/153.7/160 Navigation sandbox (Nessus ID 388625)
22 Quellen
CVE-2026-72260 | Linux Kernel up to 6.6.147/6.12.100/6.18.39/7.1.4 ASoC mediatek mt8192 pm_runtime_get_sync unusual condition (WID-SEC-2026-2852)
VulDB Updates vor 1 Std.
21 weitere Quellen
VulDB Updatesvor 1 Std.CVE-2026-72264 | Linux Kernel up to 7.1.4 tridentfb trident_pci_probe memory leak (WID-SEC-2026-2852) VulDB Updatesvor 1 Std.CVE-2026-72263 | Linux Kernel up to 7.1.4 ASoC snd_sof_load_topology memory leak (WID-SEC-2026-2852) VulDB Updatesvor 1 Std.CVE-2026-72265 | Linux Kernel up to 7.1.4 fbdev nvidiafb_probe memory leak (WID-SEC-2026-2852) VulDB Updatesvor 1 Std.CVE-2026-72266 | Linux Kernel up to 6.6.144/6.12.96/6.18.39/7.1.4 vesafb vesafb_probe memory leak (WID-SEC-2026-2852) VulDB Updatesvor 1 Std.CVE-2026-72267 | Linux Kernel up to 7.1.4 carminefb alloc_carmine_fb memory leak (WID-SEC-2026-2852) VulDB Updatesvor 1 Std.CVE-2026-72269 | Linux Kernel up to 7.1.4 fbdev uvesafb_probe memory leak (WID-SEC-2026-2852) VulDB Updatesvor 1 Std.CVE-2026-72268 | Linux Kernel up to 7.1.4 fbdev tdfxfb_probe memory leak (WID-SEC-2026-2852) VulDB Updatesvor 1 Std.CVE-2026-72271 | Linux Kernel up to 7.1.4 i740fb i740fb_probe memory leak (WID-SEC-2026-2852) VulDB Updatesvor 1 Std.CVE-2026-72270 | Linux Kernel up to 7.1.4 fbdev s3_pci_probe memory leak (WID-SEC-2026-2852) VulDB Updatesvor 1 Std.CVE-2026-72272 | Linux Kernel up to 7.1.4 fbdev/radeon radeonfb_pci_register memory leak (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72249 | Linux Kernel up to 7.1.4/7.2-rc2 flowtable input validation (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72250 | Linux Kernel up to 7.2-rc2 netfilter net/ipv6/reassembly.c nf_ct_frag6_reasm state issue (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72252 | Linux Kernel up to 7.2-rc1 nft_set_pipapo out-of-bounds write (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72253 | Linux Kernel up to 7.2-rc1 nf_conntrack_sip skb_dst null pointer dereference (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72255 | Linux Kernel up to 7.1.4 nf_queue __nf_queue reference count (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72256 | Linux Kernel up to 7.1.4 xt_cluster xt_cluster_mt initialization (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72257 | Linux Kernel up to 7.1.4 q6apm graph_callback null pointer dereference (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72258 | Linux Kernel up to 6.6.144/6.12.96/6.18.39/7.1.4 ASoC denial of service (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72259 | Linux Kernel up to 6.6.144/6.12.96/6.18.39/7.1.4 ASoC/mediatek mt8192 of_reserved_mem_device_init allocation of resources (WID-SEC-2026-2852) Phoronixvor 2 Std.Linux Overhauls Documentation For Reporting Kernel Security Bugs DEV Communityvor 4 Std.ForgeOS Booted on a Real Server: Linux Kernel Below, Only Our Own Code Above
17 Quellen
Garmin fenix 8 47mm drops $250 to $749.99 for Cyber Monday, $49 under Ultra 4
The Mac Observer vor 21 Min.
16 weitere Quellen
Latest from TechRadarvor 41 Min.I've been waiting for a better deal on the Philips LatteGo 4400 — and Amazon has delivered a record-low price for Cyber Monday Latest from TechRadarvor 1 Std.Looking to get a last-minute gaming gift before Cyber Monday is over? Latest from Windows Centralvor 2 Std.Why I bought a handheld over a gaming laptop on Cyber Monday Latest from TechRadarvor 2 Std.I found the most capable PC under $300 for Cyber Monday — Origimagic's C7 Windows 11 Pro machine packs dual Thunderbolt 4, 2.5Gb LAN, a Core 3 100U, 16GB of RAM, and a 512GB SSD OS X Dailyvor 2 Std.Cyber Monday Deals: $300 Off 16″ PROLED MacBook Pro, $100 Off AirPods Pro 3, $100 Off iPad Air, & More Latest from TechRadarvor 2 Std.Cyber Monday home office deals 2026 live — our top workspace picks from FlexiSpot, Dell, Anker, Logitech and more as Black Friday sale rolls on Latest from TechRadarvor 2 Std.The best Cyber Monday deals in the UK in 2026: top picks from Amazon, Argos, Ninja, Lego and more Latest from TechRadarvor 2 Std.Cyber Monday Australia laptop deals for 2026: score up to 52% off Lenovo, Apple, Dell, HP and more Latest from TechRadarvor 3 Std.Amazon Australia Cyber Monday deals CNETvor 3 Std.This Pocket Battery Recharges Your Phone 4 Times, and it’s Only $38 for Cyber Monday Latest from TechRadarvor 4 Std.Firebat's M1 is a cracking Ryzen AI 9 HX 470 mini PC for AI workloads — and it's packing OCuLink, 32GB of RAM, and a 1TB SSD for $1020 this Cyber Monday Latest from TechRadarvor 3 Std.The Lenovo IdeaCentre Tower Copilot+ PC with Core Ultra 7 CPU isn't discounted for Cyber Monday — and it's still the desktop computer I'd buy for work for $1049 The Vergevor 3 Std.Qobuz is my streaming service of choice and it’s on sale during Cyber Monday CNETvor 12 TagenThis Paramount Plus Cyber Monday Deal Gets You Ad-Free Viewing for Only $3 Per Month CNETvor 4 Std.Cyber Monday Meta Quest 3S Deal Knocks $53 Off and Gets You $50 Free Amazon Credit The Vergevor 5 Std.These early Cyber Monday gaming laptop deals offer the most GPU for the least money
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Building a Transactional Email CLI with Mailgun and Python

Thematisch verwandte Begriffe: Building, Transactional, Email, 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 ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
Widgets & Themen
Widgets werden geladen…
Nächster Beitrag