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

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 with
autoenrollment also to my CERT Store PS
CERT:\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-MailMessage
to send a signed message, without development experience?
Thanks in advance for cooperation.
Manfred Schüler

Hi,
could create with an other colleague a DLL file (with this informations) for successfully sending sign messages from PS-Script. 
Function SendEmailNotification # /* SEND SIGN E-MAIL */#
$SMTPBodyHtmlTemplate = Get-Content "C:\PS\Template\HTML.html" | Out-String
[System.Reflection.Assembly]::LoadFile("C:\PS\Assembly\Cpi.Net.SecureMail.dll") | Out-Null
[string]$strSmtpServer = "smtp.domain.local"
[string]$strSmtpPort = "25"
[string]$strFrom = (Get-ADUser $CurrentUser -properties mail).mail
[string]$strFromAlias = (Get-ADUser $CurrentUser -properties DisplayName).DisplayName
[string]$strTo = $UserEmailAddress
[string]$strToAlias = $UserEmailDisplayName
[String]$strSubject = "Subject as you like"
[string]$strBody = $SMTPBodyHtmlTemplate.Replace("UserDisplayname","$($UserDisplayname)")
$objMail = New-Object Cpi.Net.SecureMail.SecureMailMessage
$objFrom = New-Object Cpi.Net.SecureMail.SecureMailAddress($strFrom,$strFromAlias,$objCert,$objCert)
$objTo = New-Object Cpi.Net.SecureMail.SecureMailAddress($strTo,$strToAlias)
$objMail.From = $objFrom
$objMail.to.Add($objTo)
$objMail.Subject = $strSubject
$objMail.Body = $strBody
$objMail.IsBodyHtml = $TRUE
$objMail.IsSigned = $TRUE
$objMail.IsEncrypted = $FALSE
$objSMTPClient = New-Object System.Net.Mail.SmtpClient($strSmtpServer,$strSmtpPort)
$objSMTPClient.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
$objSMTPClient.send($objMail)
Maybe Microsoft can implement this in future versions of the cmdlets Send-MailMessage ;-)
Manfred Schüler

Similar Messages

  • HT4847 You have now exceeded your iCloud storage, including an additional amount provided to allow you to continue receiving email. As a result, you will not be able to send or receive new email messages with your iCloud email address until you free up st

    You have now exceeded your iCloud storage, including an additional amount provided to allow you to continue receiving email. As a result, you will not be able to send or receive new email messages with your iCloud email address until you free up storage space or buy more storage. I have 20GB remaining.  WHat is the issue here?

    Today I received the same message but have 4.6gb available from a total of 5.0gb. I also received the same message when i first set up my icloud account and icloud was virtually empty. Unfortunately the only way i can see to contact apple is to pay for a telephone call. If anyone knows what is going on i would appreciate knowing.

  • How to run java signed applet in vista with changing IE security options

    how to run java signed applet in vista with changing IE security options. If i change the IE security settings to low. it works.
    without changing the security setting, how to run.

    j_nanaji9 wrote:
    how to run java signed applet in vista with changing IE security options. If i change the IE security settings to low. it works.
    without changing the security setting, how to run.Can't be done without changing the security setting.

  • Unable to digitally sign or encrypt messages in Mail

    I recently switched from a PC to a Mac and I have been unable to digitally sign or encrypt any of my e-mails. I'm currently running version 3.3 (926.1/926) for Mail and I made sure that my .cer security certificate is located in Keychain Access as well as certificates for my contacts. My certificate is valid because it has the green checkmark next to it.
    I know what the *digitally sign* and encryption buttons should look like and where they should be located when composing e-mails, but they are just not there for me. Does anyone have any advice on how to fix this. Does it matter which folder the .cer security certificates should be located in for Keychain Access? Or is there a specific option I need to enable within Mail to be able to see those buttons?
    I know that Mail is recognizing security certificates for e-mails that are being sent to me because it is showing the starburst/checkmark icon next to those e-mail addresses, and my Address Book is showing that same icon next to those e-mail addresses for my contacts.

    I finally have a solution to this problem. I had been trying to use a .cer security certificate issued by Comodo, it had worked just fine on Windows but my Mac didn't seem to like it. I also tried creating my own certificate through OSX, but even after I created it I still couldn't see the buttons.
    I had someone direct me to this webpage which ultimately helped me fix the problem:
    http://allforces.com/2007/03/02/email-security/
    I ended up using Thawte to issue me another security certificate (this time it was an x.509 file), the security certificate automatically opened in Keychain Access and downloaded to the Certificates and My Certificates folder. Once I shutdown Mail and restarted it I had the buttons for both encryption and digitally signed. Of course the encryption button is still greyed out because it is a new certificate and I need to make sure my Address Book contacts have a copy of it before I can encrypt.
    Message was edited by: Matthew Little

  • How do I digitally sign projector files?

    I am currently selling apps in Flash projector .exe format.  How can I install a certificate from Verisign or Thawte?
    Roger

    I want to access the file system of the client using a
    servlet which shall be digitally signed.
    You cannot do this. It is technically impossible. You are referring to an Applet. There are two ways to get the Applet to read the files of the client system.
    1. Have the client open up security by editing the java.policy file, which is dangerous.
    2. Digitally Sign the Applet.
    How do I do it.Please send the code.
    Write the code yourself. Sorry to say, but nobody here is going to program your code for you. That is, unless you pay them money!

  • How to automate digital signing PDF Files in batch

    I am trying to find a way to automate as much as possible the placing of a digital signature on a set of PDF documents.  We have Adobe Acrobat Pro 8.1 and the machine has MS Office 2003 with Vista Business.  Here's a scenario:  A set of documents exist in a TO-BE-SIGNED folder, each unsigned.  The user uses MS Access 2003 form with a button with VBA code to open and show the first document in the folder.  The AcroExch.App, AcroExch.AVDoc, and AcroApp.Show APIs are used to do this.  I found code on the internet to do that.  Rather than having my client now have to go through all the manual steps to place a digital signature on the document, I want to streamline it to a single click if possible.  Right now he has to click Advanced > Sign and Certify > Place Signature > then click and drag > then enter his password > then click sign > then save and close the doc.  Can all this be automated?  An added bonus would be automatically saving or moving the signed doc to a different folder when it is signed.
    I have created a stamp that allows me to add a stamp with just two clicks.  Can such be done to add a digital signature?  Is it possible to add a button to the toolbar to do this?  Can it be done in Access VBA using some Acrobat API calls?  Another feature I want to include is moving quickly from one document to the next in the TO-BE-SIGNED folder.  Like the arrow buttons take you from page to page, can a button be added to the Acrobat toolbar to take you from doc to doc in a particular folder?  Or can that be done using VBA and some Acrobat API calls?  To maintain the security of the password protection and yet cut down on clicks and keystrokes, I would like to input the password just once at the beginning of the session and have it remembered or applied to all the docs that get signed as long as that session is open.
    I've found some software that purports to do much of the above, but they are all very expensive and assume a big business with big bucks.  If anyone knows of inexpensive software that will REALLY do this, I'm open to that as well, though I'd like to control the process myself if possible.  I consider myself a beginner with Acrobat and using API calls and would appreciate any help anyone can give.  Is the above clear and even possible?
    PS:  I'm new to this site and using SDK.  I posted this under Security (thinking digital signatures) and was asked to post it here, which I'm glad to do.
    Thanks much!

    Our workflow is such that on infrequent occasions, we have a digitally signed PDF file and the doctor wants to append a scanned note to it.  In the past, we could do this, but not now.  In the past, when we added the scanned doc, we received a message saying that the doc is already signed and asking if we want to overrwrite the doc.  If we respond Yes, then Acrobat would allow it and the signature would indicate that the original part of the document was not modified, but that something had been changed--namely, a doc had been appended.  The signature indicated that something had changed since it was added, but it still allowed the append.  The signature would have an exclamation point in a yellow triangle indicating the doc had been updated since signed.  For our purposes, that was okay because we know what the change is based on the original doc and we know what is appended.  Now, however, we cannot append at all.  The only thing that is different that I know of is that the doc was signed with software that is not Adobe Acrobat, even though the other software uses an Adobe Acrobat self-created digital signature.
        I hope I've explained that clearly enough.
    Thanks for your help.

  • I cleared a conversation in messages. I did not delete.  How can I get it all the messages back from this sender.

    I cleared a conversation in my messages. I do not delete. How do I get all the messages back from this sender?

    Clearing a conversation is the same as deleting the messages, so unfortunately they're gone. You could always restore from a previous backup, but you would lose anything that you've added/changed etc on your phone between the last time you synced your phone and now.

  • How to disable digital signing and saving of PDF form?

    I have a PDF form that I have created. It does not have a signature field becuase I need them to print and physically sign the form. However no matter what I do Adobe Reader offers the option to digitally sign the form (as well as save it). How do I disable this?? Thank you for the help in advance.

    Thank you for the answer and explanation.  Unfortunately I am still not sure the best solution.
    It is a business application for a city site. As a result the limit of 500 is obviously not going to work. Also for legal reasons they need the form physically signed.
    The original hope was to provide a PDF form that could be filled in (almost entirely) on the computer if desire and then printed, signed, and turned in to the city.
    What they don't want is for someone to fill it out on the computer, use the echosign and email it as they need the physical signature.
    Sounds like we might have to choose between:
    - not having it interactive (so they can just print it out and fill it out)
    Or
    - make it so they can fill it out on the computer, but include instructions that they need the print it out and physically sign it. And hope they follow the instructions.
    Again, thank you for the explanation. I think I will just have to let them decide.

  • Asked to enter PIN multiple times when sending Digitally Signed emails

    Hey everyone, I have been having a very difficult time trying to figure out why my co-workers and myself are being asked to enter our PIN multiple times when digitally signing emails.  My co-workers are looking to me for a solution, however
    I just cannot seem to find any information on as to why this is happening.  Could anyone possibly shed some light on why this may be happening?  Thanks in advanced!!! 
    P.S. We are using Outlook 2013

    Hi,
    Let's troubleshoot this issue by the following steps:
    1. Start Outlook in Safe Mode to determine whether it's 3rd-party add-ins related:
    Press Win + R, type "outlook.exe /safe" in the blank box, press Enter.
    If no issue in Safe Mode, disable the suspicious add-ins to verify which on caused the problem.
    2. Go to Control Panel and search for "Manage computer certificates" then open it, find the certificate and right click on it, choose Properties -> under General tab select "Enable all purposes for this certificate" -> Apply ->
    OK.
    3. If you create a new Outlook profile, does this issue persist? A new profile will provide a new environment for the account and it will not remove any information from the old profile. A profile corruption may be the source of this issue.
    How to create and configure email profiles in Outlook
    http://support.microsoft.com/kb/829918/en-us
    Regards,
    Melon Chen
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.
    Manage computer certificates

  • How do u send or foward  muti media messages with sound and pictures

    How do you send or forward a multi media message with both sound and pictures

    GarageBand does not have a "Normalize" feature (that's what you're friends are talking about).
    iTunes has "Sound Check" which performs that function, however I've never used it and have always been under the impression that it just affected playback within iTunes. Perhaps this is not the case, you'd have to experiment to see if it affected the audio transfered to CD.
    Many Audio Editors have a Normalize function, so you might take a look at one of them:
    http://www.thehangtime.com/gb/gbfaq2.html#audioeditors

  • How can I digitally sign a pdf document and also disallow changes to the document?

    When I digitally sign the document it does not let me lock it down - when I lock down the doc first, it does not allow for digital signature. Please help.

    The initial document should have its properties set as:
    Changing the Document: Not allowed
    Signing: Allowed
    That way no one can make changes to it but anyone may sign it. These properties are available in v9, but I'm not sure about previous versions.

  • Sending digitally signed emails from APEX

    We need the ability to digitally sign an email or group of emails generated from an APEX application via MS Exchange. Has anyone been able to do this?

    Post this to APEX forum....
    Sim

  • How do you digitally sign or electronically sign a document in Preview?

    Heya
    I'm wondering if it's possible to "digitally sign" or "electronically sign" a document in Preview? This feature exists in Adobe Acrobat. If not, does anyone know a workaround or plugin to accomplish this? Thanks!

    I believe the free Acrobat reader (9) will do that.
    Otherwise you'll need the Pro version.
    Here is what the Reader page says:
    With each new release, Adobe continues to add functionality to Adobe® Reader® software, making it an extremely versatile tool capable of viewing, searching, *digitally signing*, verifying, printing, and collaborating with electronic documents.

  • How do I digitally sign with reader XI when the fill and sign functions are grayed out?

    I am using Adobe Reader XI. I am suppose to digitally sign a fillable .pdf document for online submission. However, the fill and sign functions are grayed out.
    What are my options to put a signature in the signature box of the document?
    Thank you in advance!

    Pat Willener,
    Thank you for replying.
    Here is an image capture of the properties.
    The document is part of a job application that is suppose to be digitally signed and submitted soon. I have thought about printing, signing, and redigitizing to submit, however, the cells are statically sized and do not expand to include all of the information when printed.
    Any suggestions will be appreciated.

  • How do I fix a problem group messaging with one non-iphone user and several iphone users?

    My brother switched from an iphone to another smart phone several months ago. The rest of our family all have iphones. When he made the switch, my sister suddenly had problems with group messages going through for him--they went through as imessages for her instead of SMS or MMS. I didn't have that problem until a few days ago. I upgraded to an iphone 6 about a week ago, and group messaging my brother worked fine at first, and then a couple of days ago, suddenly stopped working. If I am texting him singly, it's fine. But in group texts, it automatically sets at imessage.
    He has called apple and his number is completely deregistered with imessage. Does anyone know what else we can try? I have deleted all previous messages that were imessage and deleted and re-entered him as a contact.

    I'm assuming neither of you heard back from anyone?  I'm having the same issue - just in the last few days.  The non-iphone user is not receiving texts from the group message because it is sending as an imessage.  It flipped to imessage randomly last week.  I've tried to delete the group message and restart it; same issue.  Would love to hear how to resolve, Apple!

Maybe you are looking for

  • Default Dashboard not working after user login

    Hi All, We have one issue in 11.1.1.7.1 where PORTALPATH is not working for users. As a result, user lands on home page/recent page instead of the default dashboard after login. I followed Doc ID 1576576.1 and Bug 17071629 - PORTALPATH SESSION VARIAB

  • ABAP Program Name CHanging the PSA Load status

    Hi, Our Scenario is Non-SAP -> PI -> BI. Every Day PI reads the file from source and it will directly upload to PSA in BI.But in PSA the status will show as yellow only it is not turning to green.But I am able to see the data in PSA but status is yel

  • Problem in Adobe Interactive forms

    Hi ,             I have created interface and context for my form using Form Builder. When i am designing Layout and when i click on SAVE, It was giving an error that 'Error while transforming object data'. ADS and java stack are installed in the sys

  • Any forum where poor technical support/customer care support can be reported?

    I have a 6 month old iMac 21.5 inch bought in Pune, India. It is stuck in the reboot loop and based on suggestion here, I called Apple Care and they had the Authorized Support Provider come home and take it away for repairs. It has been 15 working da

  • Does ODI keeps the record of last run date of interface?

    Target:Oracle Source:MS SQL ODI:11g My requirement is I have a source table, Whatever operations performed on that (like insert,update etc) table, I want to load those records into the target table. For that I have created an Interface which runs dai