我在PowerShell中有一个工作脚本来发送电子邮件。 我需要知道如何将已发送电子邮件的副本放入邮件服务器上的“已发送”文件夹中。
$EmailTo = "you@email.com"
$Subject = "Subject"
$EmailFrom = "me@email.com"
$Body = Get-Content -Path body.html
$SMTPServer = "mail.email.com"
$SMTPMessage = New-Object System.Net.Mail.MailMessage ($EmailFrom, $EmailTo, $Subject, $Body)
$SMTPMessage.IsBodyHTML = $true
$SMTPClient = New-Object Net.Mail.SmtpClient ($SmtpServer, 25)
$SMTPClient.EnableSsl = $False
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential ("me@email.com", "password");
$SMTPClient.Send($SMTPMessage)