Powershell module to send email without need for SMTP relay server
This script module contains Send-Email function that can be used to send email messages from Powershell. This function has the following advantages/differences compared to the Powershell native Send-MailMessage cmdlet:
- It does not need or depend on an SMTP relay server. It acts as its own SMTP server (sending only)
- It returns a PS object containing information about the status of the email sent (or failed)
- v1.1 added DKIM implementation (special thanks to Dave Wyatt for guidance with this update)
Although this was purpose-built to handle bulk emails, it can also be used for script/Powershell based notifications/alerting – similar to the work of Jason (Robert) Morgan.
To use this module, download the .rar file, use WinRar or similar tool to extract its contents, unblock the files, open the Installer script in Powershell_ISE and run it. Then simply use the Send-Email function as you would any PS cmdlet.
Send-Email -From email@example.com -To firstname.lastname@example.org -Subject ‘Test Message’ -Body ‘this is the email body text’ -MyFQDN ‘mail.thismachinedomain.com’ -ShowSMTP