Powershell – System.Net.Mail

Facebooktwittermail

Send-MailMessage cmdletはPowershell Ver.2.0から利用できますが、SMTPポートの変更ができません

もう一つの方法として System.Net.Mailを使用します
Sending mail with PowerShell
http://www.philerb.com/2011/11/sending-mail-with-powershell/

ISO-2022-JPでエンコードされたメールが送信できました

HTMLメールは下記のようになります

@”~”@は複数行の文字列を変数に代入する方法だそうです。
Windows PowerShell Tip of the Week
Using Windows PowerShell “Here-Strings”
http://technet.microsoft.com/ja-jp/library/ee692792.aspx

Leave a Reply