Created
April 1, 2015 20:45
-
-
Save matejskubic/dd2b9abf291906fd972a to your computer and use it in GitHub Desktop.
Create eml file from powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$mailMessage = New-Object System.Net.Mail.MailMessage | |
$mailMessage.From = New-Object System.Net.Mail.MailAddress("[email protected]") | |
$mailMessage.To.Add("[email protected]") | |
$mailMessage.Subject = "FYI: How to save mail messages to .eml files" | |
$mailMessage.Body = "This can be accomplished by changing the smtp delivery method to a pickup directory..." | |
$smtpClient = New-Object System.Net.Mail.SmtpClient | |
$smtpClient.DeliveryMethod = [System.Net.Mail.SmtpDeliveryMethod]::SpecifiedPickupDirectory; | |
$smtpClient.PickupDirectoryLocation = "c:\temp\_some_new_folder_"; | |
$smtpClient.Send($mailMessage); | |
$smtpClient.Dispose() | |
$mailMessage.Dispose() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment