I want to send encrypted E-Mails via Aspose.
I have used encrpyt() method along with the public key path as shown below:
MailMessage eMsg = originalMsg.encrypt(Files.readAllBytes(publicCertFilePath), “’”);
isEncrypted() returns true and I assume that the encryption works.
But the problem is when I send the E-Mail using SmtpClient client.send() method, I get the following error:
class com.aspose.email.SmtpException: Failure sending mail. —> class com.aspose.email.system.exceptions.InvalidOperationException: Operation is not valid due to the current state of the object.
How do I resolve this issue?