NetCmdlets 2016
NetCmdlets 2016
Questions / Feedback?

Send-Email Cmdlet

Parameters   Output Objects   Configuration Settings  

The Send-Email cmdlet is used to send Internet mail using the SMTP protocol (the Internet mail standard).

Syntax

Send-Email [parameters]

Remarks

This cmdlet implements a standard SMTP client as specified in RFC 821, and also supports the SSL-enabled equivalent (RFC 2487). To send a message, set the Server, To, Subject, From, and Message parameters.

Additional recipients can be set with the CC and BCC parameters. To specify multiple recipients, in the To, CC, and BCC parameters, simply specify the destination email addresses separated by commas.

One or more attachments can be added by setting the Attachment parameter. HTML Messages may be sent by setting the MessageHTML parameter.

SSL communications are supported. When communicating with an SSL server, set the SSL parameter. If authentication is required, set the Credential parameter.

The cmdlets support pipeline input for some of their parameters. Prebuilding an object and piping it to the cmdlet is very useful, but should be used with caution to prevent security conflicts. Steps have been taken to decrease the risk of a possibly accidental pipe to the cmdlet, for instance, the Credential parameter cannot be piped to the cmdlet and must be specified manually.


# Send a simple message
send-email -server myserver -from myuser@mydomain -to friend@domain -subject "my subject" -message "message text" -attachment "C:\test.txt"
# Send an HMTL message
send-email -server myserver -from myuser@mydomain -to friend@domain -subject "New subject" -messagehtml "HTML Message"

Connection Handling

This cmdlet supports persistent connections through the Connection parameter. To establish a new Email connection, use the Connect-Email cmdlet. To close the connection, use the Disconnect-Email cmdlet.

Parameter List


The following is the full list of the parameters of the cmdlet with short descriptions. Click on the links for further details.

ConnectionAn already established connection.
LogFileThe location of a file to which debug information is written.
AttachmentThe path to any files which are to be attached to the message.
AuthMechanismThe authentication mechanism to be used when connecting to the mail server.
BCCA comma separated list of addresses for blind carbon copies (optional).
CCA comma separated list of addresses for carbon copies (optional).
CertPasswordThe password to the certificate store.
CertStoreThe name of the certificate store for the client certificate.
CertStoreTypeThe type of certificate store for the client certificate.
CertSubjectThe subject of the certificate used for client authentication.
ConfigSpecifies one or more configuration settings.
CredentialThe PSCredential object to use for user/password authentication.
FirewallHostName or IP address of firewall.
FirewallPasswordA password if authentication is to be used when connecting through the firewall.
FirewallPortThe port of the firewall to which to connect.
FirewallTypeDetermines the type of firewall to connect through.
FirewallUserA user name if authentication is to be used connecting through a firewall.
ForceForces the cmdlet to accept the default behavior instead of querying the user.
FromThe email address of the sender (required).
ImportanceImportance of the mail message.
LocalIPThe IP address of the local interface to use.
LogFileThe location of a file to which debug information is written.
MessageThe full text of the message to be sent (without headers).
MessageHTMLThe full text of the HTML message to be sent (without headers).
MessageIdSets the message Id used by the cmdlet.
PasswordThe password to use for authentication.
PortThe TCP port in the remote host to which to connect.
ReplyToThe email address to which replies should be sent.
ServerThe address of the Server.
SSLDetermines how the cmdlet starts SSL negotiation.
SSLAcceptThe encoded public key of the certificate which is to be trusted explicitly.
SubjectThe subject of the email.
TimeoutThe maximum time allowed for the operation.
ToA comma separated list of addresses for destinations.
UserThe username to use for authentication.

Output Objects


The following is the full list of the output objects returned by the cmdlet with short descriptions. Click on the links for further details.

SMTPDeliveryObject which indicates whether the message was received.

Configuration Settings


The following is a list of configuration settings for the cmdlet with short descriptions. Click on the links for further details.

AllowEmptyToIf set to True, then the SendTo property is not required.
AuthorizationIdentityThe value to use as the authorization identity when SASL authentication is used.
CharsetWhen set, the message headers will be encoded using the specified Charset.
HelloThe argument for HELO (herald) command to the server (defaults to local host name).
KeepQueueIf set to True, queued files are not deleted after a successful send.
MaxHeaderLengthMaximum length for headers to avoid line folding (default 80).
MessageHeadersStringString representation of RFC822-encoded headers of the message.
MessageIdAlgorithmDetermines the algorithm used to hash the random MessageId.
OtherHeadersAn RFC 822 compliant string consisting of extra headers.
ReturnPathSets the Return-Path to be used for sending email.
SendRSETWhether to send RSET command.
StopOnToErrorsInstructs the cmdlet to stop sending the message if the server does not acknowledge any of the TOs.
StopOnCcErrorsInstructs the cmdlet to stop sending the message if the server does not acknowledge any of the CCs.
StopOnBccErrorsInstructs the cmdlet to stop sending the message if the server does not acknowledge any of the BCCs.
TransferTextThe current portion of the message being sent.
ConnectionTimeoutSets a separate timeout value for establishing a connection.
FirewallAutoDetectTells the cmdlet whether or not to automatically detect and use firewall system settings, if available.
FirewallHostName or IP address of firewall (optional).
FirewallPasswordPassword to be used if authentication is to be used when connecting through the firewall.
FirewallPortThe TCP port for the FirewallHost;.
FirewallTypeDetermines the type of firewall to connect through.
FirewallUserA user name if authentication is to be used connecting through a firewall.
KeepAliveTimeThe inactivity time in milliseconds before a TCP keep-alive packet is sent.
KeepAliveIntervalThe retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received.
LingerWhen set to True, connections are terminated gracefully.
LingerTimeTime in seconds to have the connection linger.
LocalHostThe name of the local host through which connections are initiated or accepted.
LocalPortThe port in the local host where the cmdlet binds.
MaxLineLengthThe maximum amount of data to accumulate when no EOL is found.
MaxTransferRateThe transfer rate limit in bytes per second.
ProxyExceptionsListA semicolon separated list of hosts and IPs to bypass when using a proxy.
TCPKeepAliveDetermines whether or not the keep alive socket option is enabled.
UseIPv6Whether to use IPv6.
TcpNoDelayWhether or not to delay when sending packets.
AbsoluteTimeoutDetermines whether timeouts are inactivity timeouts or absolute timeouts.
FirewallDataUsed to send extra data to the firewall.
InBufferSizeThe size in bytes of the incoming queue of the socket.
OutBufferSizeThe size in bytes of the outgoing queue of the socket.
UseBackgroundThreadWhether threads created by the cmdlet are background threads.
UseInternalSecurityAPITells the cmdlet whether or not to use the system security libraries or an internal implementation.

 
 
Copyright (c) 2019 /n software inc. - All rights reserved.
NetCmdlets 2016 - Version 16.0 [Build 7240]