ElektoMailPosh
2.0.1
Lightweight SMTP email module for PowerShell. Zero dependencies, several sending accounts like msmtp (passwords in the Windows Credential Manager or an owner-only file) or environment-based configuration, automatic retry with exponential backoff. Perfect for CI/CD pipelines, automation scripts, and scheduled tasks.
Minimum PowerShell version
7.4
Installation Options
Owners
Copyright
(c) 2024-2026 Elekto Produtos Financeiros. Licensed under the MIT License.
Package Details
Author(s)
- JP Negri
Tags
Email SMTP Mail Send-Mail Notification Automation CI-CD DevOps GitHub-Actions Azure-Pipelines Lightweight Simple Environment-Variables Accounts Reply-To Cross-Platform Windows Linux macOS
Functions
Send-Mail Get-MailAccount Set-MailAccount Remove-MailAccount
PSEditions
Dependencies
This module has no dependencies.
Release Notes
## 2.0.1
- Remove-MailAccount takes several names, wildcards and the accounts piped from Get-MailAccount; Remove-MailAccount * removes every account and its stored password, so Send-Mail goes back to the SMTP_* environment variables
- The README says that upgrading from 1.x needs only the update, and warns that a Windows scheduled task set to "Do not store password" (S4U) cannot read the Credential Manager
- Copyright 2024-2026
## 2.0.0
- Requires PowerShell 7.4 or later; Windows PowerShell 5.1 is no longer supported
- Accounts, like those of msmtp: Set-MailAccount, Get-MailAccount and Remove-MailAccount keep named sets of SMTP settings (server, port, user, sender, default recipients), and Send-Mail -Account sends from one of them, or from the default account
- Account passwords go to the Windows Credential Manager, or on Linux and macOS to a file only its owner can read; the SMTP_PASS_<ACCOUNT> environment variable takes precedence
- Set-MailAccount -FromEnvironment moves a configuration in SMTP_* environment variables to an account
- Added -ReplyTo parameter (default: the account's ReplyTo or the SMTP_REPLY_TO environment variable)
- Added -BodyFile parameter, for long messages: the body is read from a UTF-8 file, and an .html or .htm file is sent as HTML
- Added -MessageId, -InReplyTo and -References parameters, so a follow-up (an alert and then its resolution, or a reply) shows in the same conversation
- A sender display name with commas or quotes no longer breaks the From header
## 1.0.1
- The copyright in the manifest names Elekto Produtos Financeiros, as the LICENSE does
## 1.0.0
- Added -Cc and -Bcc parameters (defaults: SMTP_CC and SMTP_BCC environment variables)
- -To now accepts multiple addresses (array or comma-separated list, also in SMTP_TO)
- Added SMTP_FROM_NAME environment variable as the default sender display name
- Body can come from the pipeline; piped lines are joined and sent as a single email
- Added -Priority parameter (Low, Normal, High)
## 0.2.1
- Fixed empty default sender display name (-FromName) on Linux and macOS: now uses [Environment]::MachineName instead of $env:COMPUTERNAME
- X-Mailer header now reads the version from the module manifest
- Module loader builds the Public path with Join-Path instead of a hard-coded backslash
## 0.2.0
- Added file attachments support (-Attachments parameter)
- Added automatic retry with exponential backoff
- Added X-Mailer header per RFC 2076
- Environment-based configuration for CI/CD compatibility
- PowerShell 5.1+ compatibility
FileList
- ElektoMailPosh.nuspec
- ElektoMailPosh.psd1
- Private\Accounts.ps1
- Public\Remove-MailAccount.ps1
- LICENSE
- README.md
- Public\Send-Mail.ps1
- Public\Get-MailAccount.ps1
- ElektoMailPosh.psm1
- Private\PasswordStore.ps1
- Public\Set-MailAccount.ps1