Evotec

Project

PSWriteHTML

PSWriteHTML is an open-source PowerShell project with packages, release history, and working documentation.

Stars 995
Forks 114
Open issues 69
PowerShell Gallery downloads 7,436,513
Release v1.41.0
Language: PowerShell Updated: 2026-04-11

API Reference

Function

Email

Namespace PSWriteHTML

Sends an email with specified parameters.

Remarks

This function sends an email with the provided parameters including recipients, subject, content, and server settings.

Examples

Authored help example

EXAMPLE 1


Email -FilePath 'C:\Path'
        

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

Email [-AttachSelf] [-AttachSelfName <String>] [-BCC <String[]>] [-CC <String[]>] [-DeliveryNotifications <OnSuccess|OnFailure|Delay|Never>] [-Email <ScriptBlock>] [-Encoding <String>] [-FilePath <String>] [-From <String>] [-Online] [-OutputHTML] [-Password <String>] [-PasswordAsSecure] [-PasswordFromFile] [-Port <Int32>] [-Priority <Low|Normal|High>] [-ReplyTo <String>] [-Server <String>] [-SSL] [-Subject <String>] [-Suppress <Boolean>] [-To <String[]>] [-Username <String>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

AttachSelf SwitchParameter optionalposition: namedpipeline: Falsealiases: SelfAttach
Switch parameter to attach the email to itself.
AttachSelfName String optionalposition: namedpipeline: False
Specifies the name of the attached email.
BCC String[] optionalposition: namedpipeline: False
Specifies the email addresses of the blind carbon copy recipients.
CC String[] optionalposition: namedpipeline: False
Specifies the email addresses of the carbon copy recipients.
DeliveryNotifications Object optionalposition: namedpipeline: Falsevalues: 4
Specifies the type of delivery notifications. Valid values are 'None', 'OnSuccess', 'OnFailure', 'Delay', or 'Never'. Default is 'None'.
Possible values: OnSuccess, OnFailure, Delay, Never
Email ScriptBlock optionalposition: 0pipeline: False
Specifies the ScriptBlock containing the email content and additional parameters.
Encoding String optionalposition: namedpipeline: False
[Obsolete] Deprecated parameter. Encoding is set to UTF8 to prevent errors.
FilePath String optionalposition: namedpipeline: False
Specifies the file path for attachments.
From String optionalposition: namedpipeline: False
Specifies the email address of the sender.
Online SwitchParameter optionalposition: namedpipeline: False
Switch parameter to send the email online without saving it.
OutputHTML SwitchParameter optionalposition: namedpipeline: False
Switch parameter to output the email content as HTML.
Password String optionalposition: namedpipeline: False
Specifies the password for authentication with the SMTP server.
PasswordAsSecure SwitchParameter optionalposition: namedpipeline: False
Switch parameter to treat the password as a secure string.
PasswordFromFile SwitchParameter optionalposition: namedpipeline: False
Switch parameter to indicate that the password is read from a file.
Port Int32 optionalposition: namedpipeline: False
Specifies the port number for the SMTP server. Default is 587.
Priority String optionalposition: namedpipeline: Falsevalues: 3
Specifies the priority of the email. Valid values are 'Low', 'Normal', or 'High'. Default is 'Normal'.
Possible values: Low, Normal, High
ReplyTo String optionalposition: namedpipeline: False
Specifies the email address to set as the reply-to address.
Server String optionalposition: namedpipeline: False
Specifies the SMTP server for sending the email.
SSL SwitchParameter optionalposition: namedpipeline: False
Switch parameter to enable SSL for the SMTP connection.
Subject String optionalposition: namedpipeline: False
Specifies the subject of the email.
Suppress Boolean optionalposition: namedpipeline: Falsealiases: Supress
Switch parameter to suppress sending the email.
To String[] optionalposition: namedpipeline: False
Specifies the email addresses of the primary recipients.
Username String optionalposition: namedpipeline: False
Specifies the username for authentication with the SMTP server.