Quantcast
Channel: Exchange Server 2013 - Mail Flow and Secure Messaging forum
Viewing all articles
Browse latest Browse all 4249

How to send digitally sign S/MIME messages with Powershell cmdlet Send-MailMessage?

$
0
0

Hello,

using AD Windows PKI I assigned a certificate EKU (1.3.6.1.5.5.7.3.4) to sign emails and get this withautoenrollment also to my CERT Store PSCERT:\CurrentUser\UserDS\ or the certificate could found via MMC / certificates in the store structur under "Active Directory User Object".
Signed messages (red icon) to send as S/MIME message using Outlook 2010 is not a problem.

Using PowerShell cmdlet Send-MailMessage to be sent company notification for a new passwordpolicy some days before pwd expired?! I use the cmdlet already successfully to filling HTML bodies with variables and send to individuals accounts.

Reduced simplified PS code:

#
$SMTPBodyHtmlTemplate = Get-Content "C:\PS\Template\HTMLBody.html" | Out-String
#
Function SendEmailNotification # /* SEND E-MAIL Notification to User */#
{
#
[string] $SMTPServer = "mail.domain.local"
#
$CurrentUser = "$env:username"
[string]$SMTPFrom = (Get-ADUser $CurrentUser -properties mail).mail
#
[string[]] $SMTPTo = $($Obj.EmailAddress)
#
[string]$SMTPSubject = "Notification!"
#
[String]$SMTPBodyHtml = $SMTPBodyHtmlTemplate.Replace("UserDisplayname","$($UserDisplayname)")
#
Send-MailMessage -From $SMTPFrom -To $SMTPTo -Subject $SMTPSubject -BodyAsHtml $SMTPBodyHtml -dno OnFailure -SmtpServer $SMTPServer -encoding ([System.Text.Encoding]::UTF8) -ErrorAction Continue
#
}
#

How can I use the PSDrive own CERT and using PowerShell cmdlet Send-MailMessageto send a signed message, without development experience?

Thanks in advance for cooperation.


Manfred Schüler


Viewing all articles
Browse latest Browse all 4249

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>