PowerShell

A one-liner from Windows, for scripts and scheduled tasks.

1Send a test message

Your sandbox credentials
$password = ConvertTo-SecureString "pw_0000000000000000" -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential("mc_0000000000000000", $password)

Send-MailMessage -SmtpServer "smtp.mailclutch.com" -Port 587 -UseSsl `
  -Credential $credential `
  -From "staging@example.com" `
  -To "anyone@example.com" `
  -Subject "Sandbox check" `
  -Body "<h1>Hello from PowerShell</h1>" -BodyAsHtml

-UseSsl here means STARTTLS, which is what port 587 expects.

Watch it land

Open the sandbox and the message is there — rendered HTML, plain text, raw source, attachments, and the SPF, DKIM and DMARC verdicts. It updates live, so you can leave it open next to your terminal.

Nothing is ever delivered onward, whatever address you send to; claim the sandbox with an account and it stays.

Awaiting your email

Send from any address; it stops here rather than going onward. The sandbox keeps what it catches for 24 hours.

Go further

  • No implicit TLS

    -UseSsl only negotiates STARTTLS; the cmdlet cannot do implicit TLS. Stay on 587, or on 2525 if that port is blocked — 465 will hang.

  • TLS 1.2 on Windows PowerShell 5.1

    On 5.1 the default security protocol may exclude TLS 1.2. Run [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 first.

Official documentationSend-MailMessage (opens in a new tab)