Code Examples

Ready-to-run, production-ready examples for mx.msgwing.com:465 (SSL/TLS) or :587 (STARTTLS), one file per language — all in the GitHub repository:

Language File
Python python-zerosmtp.py
PHP (PHPMailer) php-zerosmtp.php
PHP (Symfony Mailer) php-symfony-mailer-zerosmtp.php
Node.js node-zerosmtp.mjs
TypeScript ts-zerosmtp.ts
Bash (curl) bash-curl-zerosmtp.sh
Bash (swaks) bash-swaks-zerosmtp.sh
Java java-zerosmtp.java
C# (.NET / MailKit) cs-zerosmtp.cs
Go go-zerosmtp.go
Ruby ruby-zerosmtp.rb
Rust rust-zerosmtp.rs
Kotlin kotlin-zerosmtp.kt
Swift swift-zerosmtp.swift
PowerShell pwsh-zerosmtp.ps1

Each example reads credentials from ZEROSMTP_* environment variables (ZEROSMTP_USERNAME, ZEROSMTP_PASSWORD, ZEROSMTP_FROM, ZEROSMTP_TO, ZEROSMTP_SUBJECT) — never hardcode real credentials into a script.

See the Quickstart for how to get @msgwing.com credentials, and Troubleshooting if a send hangs or fails.