S/MIME: Create encrypted message
First follow the instructions in the corresponding how-to article to setup the message. Next you need to create an S/MIME message part handler (an instance of TElMessagePartHandlerSMime class) and assign it to MessagePartHandler property of the main message part.
Set TElMessagePartHandlerSMime.EncoderSigned property to true and optionally set TElMessagePartHandlerSMime.EncoderSignOnlyClearFormat property.
You also need to assign the certificate storage with the certificates, used to sign the message, to TElMessagePartHandlerSMime.EncoderSignCertStorage property. The certificate to use for signing is chosen based on the email address specified in the From field of the message.
Finally you can assemble the message to a stream using AssembleMessage() method.