Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Send-SmtpMail

Send-SmtpMail

pscx.dll

Synopsis

PSCX Cmdlet: Sends email via specified SMTP server to specified recipients.

Syntax

Send-SmtpMail [-To] [-AttachmentLiteralPath] [-AttachmentPath] [-Bcc] [-Body] [-Cc] [-Credential] [-From] [-HtmlBody] [-InputObject] [-PassThru] [-PortNumber] [-Priority] [-ReplyTo] [-SmtpHost] [-Subject] [-Timeout] [-Width] [<CommonParameters>]

Send-SmtpMail [-To] [-Anonymous] [-AttachmentLiteralPath] [-AttachmentPath] [-Bcc] [-Body] [-Cc] [-From] [-HtmlBody] [-InputObject] [-PassThru] [-PortNumber] [-Priority] [-ReplyTo] [-SmtpHost] [-Subject] [-Timeout] [-Width] [<CommonParameters>]

Detailed Description

Sends email via specified SMTP server to specified recipients. This cmdlet checks for existence of several preference that if set can make this cmdlet much easier to use. Those preference variables are: * $PscxSmtpHostPreference="smtp.example.net" * $PscxSmtpPortPreference=587 * $PscxSmtpFromPreference="john_doe@example.net"

Parameters

-To <String[]>

Specifies who the email will be sent to.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Anonymous <SwitchParameter>

Connect to SMTP host anonymously.

Aliases

None

Required?

false

Position

named

Default value

False

Accept pipeline input?

false

Accept wildcard characters?

false

-AttachmentLiteralPath <String[]>

Specifies literal paths (no wildcard expansion) to attachments for the email.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-AttachmentPath <String[]>

Specifies paths to attachments for the email.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Bcc <String[]>

Specifies who to BCC on the email.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Body <String>

Specifies the body of the email.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Cc <String[]>

Specifies who to CC on the email.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Credential <PSCredential>

Specifies credentials required to aunthenticate on the SMTP host.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-From <String>

Specifies who the email is from.

Aliases

None

Required?

false

Position

named

Default value

Value of $PscxSmtpFromPreference if defined, otherwise null.

Accept pipeline input?

false

Accept wildcard characters?

false

-HtmlBody <SwitchParameter>

Indicates that the body of the message is HTML.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-InputObject <PSObject>

Input objects are rendered to text using Out-String and placed in the body of the message. The Width parameter can be used to control the width of string generated by Out-String.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

true (ByValue)

Accept wildcard characters?

false

-PassThru <SwitchParameter>

Causes the MailMessage object to be passed to the next stage of the pipeline.

Aliases

None

Required?

false

Position

named

Default value

False

Accept pipeline input?

false

Accept wildcard characters?

false

-PortNumber <Nullable`1>

Specifies which port to use on the SMTP host.

Aliases

None

Required?

false

Position

named

Default value

Value of $PscxSmtpPortPreference if defined, otherwise 25.

Accept pipeline input?

false

Accept wildcard characters?

false

-Priority <MailPriority>

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-ReplyTo <String>

Specifies who replies to the email will be sent to.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-SmtpHost <String>

Specifies which SMTP host to use to send the email.

Aliases

None

Required?

false

Position

named

Default value

Value of $PscxSmtpHostPreference if defined, otherwise null.

Accept pipeline input?

false

Accept wildcard characters?

false

-Subject <String>

Specifies the subject of the email.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Timeout <Int32>

Specifies timeout for SMTP Server.

Aliases

None

Required?

false

Position

named

Default value

100 seconds.

Accept pipeline input?

false

Accept wildcard characters?

false

-Width <Nullable`1>

Specifies the width for Out-String to render pipeline input objects to text.

Aliases

None

Required?

false

Position

named

Default value

Out-String default width is used if Width not specified.

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type


Return Type


Notes

Examples

-------------------------- EXAMPLE 1 --------------------------

              Send-SmtpMail -SmtpHost smtp.example.net -To jane_doe@example.net `
              -From john_doe@example.net -Subject "Hi there" -Credential (get-credential) `
              -Body @"
              >> Hi Jane,
              >> Let's do lunch.
              >> --
              >> John"
              >> "@
              >>