API Reference
Function
Email
Sends an email with specified parameters.
Remarks
This function sends an email with the provided parameters including recipients, subject, content, and server settings.
Examples
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 SetsParameters
- AttachSelf SwitchParameter
- Switch parameter to attach the email to itself.
- AttachSelfName String
- Specifies the name of the attached email.
- BCC String[]
- Specifies the email addresses of the blind carbon copy recipients.
- CC String[]
- Specifies the email addresses of the carbon copy recipients.
- DeliveryNotifications Object
- 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
- Specifies the ScriptBlock containing the email content and additional parameters.
- Encoding String
- [Obsolete] Deprecated parameter. Encoding is set to UTF8 to prevent errors.
- FilePath String
- Specifies the file path for attachments.
- From String
- Specifies the email address of the sender.
- Online SwitchParameter
- Switch parameter to send the email online without saving it.
- OutputHTML SwitchParameter
- Switch parameter to output the email content as HTML.
- Password String
- Specifies the password for authentication with the SMTP server.
- PasswordAsSecure SwitchParameter
- Switch parameter to treat the password as a secure string.
- PasswordFromFile SwitchParameter
- Switch parameter to indicate that the password is read from a file.
- Port Int32
- Specifies the port number for the SMTP server. Default is 587.
- Priority String
- Specifies the priority of the email. Valid values are 'Low', 'Normal', or 'High'. Default is 'Normal'.
- Possible values:
Low,Normal,High - ReplyTo String
- Specifies the email address to set as the reply-to address.
- Server String
- Specifies the SMTP server for sending the email.
- SSL SwitchParameter
- Switch parameter to enable SSL for the SMTP connection.
- Subject String
- Specifies the subject of the email.
- Suppress Boolean
- Switch parameter to suppress sending the email.
- To String[]
- Specifies the email addresses of the primary recipients.
- Username String
- Specifies the username for authentication with the SMTP server.