2,187
edits
(Initial creation - content from PowerShell Examples page) |
(Added "Different Reply To") |
||
Line 1: | Line 1: | ||
{| class="vwiki-boxout" | |||
|- | |||
! See also [http://technet.microsoft.com/en-us/library/hh849925.aspx Send-MailMessage] | |||
|- | |||
| Since PowerShell v2, a standard CmdLet (<code>Send-MailMessage</code>) exists to send emails with. This page was originally created in the v1 days. | |||
However, there are things that cannot be done with the standard CmdLet (eg set a Reply From address) which can be done by using the .NET MailMessage object as described below. | |||
|} | |||
Emails can be sent very simply if no attachment is needed.... | Emails can be sent very simply if no attachment is needed.... | ||
Line 44: | Line 52: | ||
http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx | http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx | ||
== Different Reply To == | |||
In order to set the ReplyTo field, so that replies get sent to a different address than the From field, use the following property... | |||
<source lang="powershell"> | |||
$msg.ReplyTo = "someone@domain.com" | |||
</source> | |||
[[Category:PowerShell]] | [[Category:PowerShell]] | ||
[[Category:SMTP]] | [[Category:SMTP]] |