Send an email message.

      Send-MailMessage [-To] string[] [-Subject] string -From string
         [[-Body] string] [[-SmtpServer] string] [-Attachments string[]]
            [-Bcc string[]]  [-Cc string[]] [-BodyAsHtml]
               [-Credential PSCredential] [-DeliveryNotificationOption NotifyOptions]
                  [-Encoding Encoding] [-Priority {Normal | Low | High}]
                     [-UseSsl] [CommonParameters]

   -Attachments string[]
       The path and file names of files to be attached to the email message.
       Use this parameter or pipe the path/file names.

   -Bcc string[]
       Email addresses that receive a copy of the mail but are not listed as recipients of the message.
       Enter names (optional) and the email address, such as "Name <>"

   -Body string
       The body (content) of the email message.

       Indicates that the value of the Body parameter contains HTML.

   -Cc string[]
       Email addresses to which a carbon copy (CC) of the email message is sent.
       Enter names (optional) and the email address, such as "Name <>".

   -Credential PSCredential
       A user account that has permission to perform this action. The default is the current user.

       Type a user name, such as "User64" or "Domain64\User64". Or, enter a PSCredential object,
       such as one from the Get-Credential cmdlet.

       Delivery notifications (if accepted by the recipient) will be passed back to the email address
       specified in the -From parameter. The alias for this parameter is "-dno".


          None        No notification.
          OnSuccess   Notify if the delivery is successful.
          OnFailure   Notify if the delivery is unsuccessful.
          Delay       Notify if the delivery is delayed.
          Never       Never notify.

   -Encoding Encoding
       The encoding used for the body and subject.
       Valid values are ASCII, UTF8, UTF7, UTF32, Unicode, BigEndianUnicode, Default, and OEM.

   -From string
       The address from which the mail is sent.
       Enter a name (optional) and email address, such as "Name <>". This parameter is required.

   -Priority MailPriority
       The priority of the email message.
       The valid values for this are Normal, High, and Low.

   -SmtpServer string
       The name of the SMTP server that sends the email message.

       The default value is the value of the $PSEmailServer preference variable.
       If the preference variable is not set and this parameter is omitted, the command fails.

   -Subject string
       The subject of the email message. This parameter is required.

   -To string[]
       The addresses to which the mail is sent.
       Enter names (optional) and the email address, such as "Name <>". Required.

       Use the Secure Sockets Layer (SSL) protocol to establish a connection to the remote computer 
       to send mail. By default, SSL is not used.

       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -OutVariable.


Send an email (with no body) from User01 to User02:

C:\PS> send-mailmessage -to "User01 <>" -from "User02 <>" -subject "Test mail"

Send a high priority email with an attachment from User01 to two other users:

C:\PS> send-mailmessage -from "User01 <>" -to "User02 <>", "User03 <user03@examp>" -subject "Sending the Attachment" -body "Forgot to send the attachment. Sending now." -Attachment "data.cs
v" -priority High -dno onSuccess, onFailure -smtpServer

Send an email message from User01 to the ITGroup mailing list with a copy (CC) to User02 and a blind carbon copy (BCC) to the IT manager (ITMgr).:

C:\PS> send-mailmessage -to "ITGroup <>" -from "User01 <>" -cc "User02 <>" -bcc ITMgr <> -subject "Don't forget today's meeting!" -credential domain64\admin01 -useSSL

Send an email message containing unicode characters:

Send-MailMessage -subject "Föreign chäräcters" -Body 'voilà hêre is yöur messãge' -to "User01 <>" -from "User02 <>" -Encoding UTF8

“Learning music by reading about it is like making love by mail” ~ Luciano Pavarotti


Out-Printer - Send the output to a printer

© Copyright 1999-2014
Some rights reserved