Decrypt Mail/Mapi Message

Hello
Is this the correct way to go to decrypt?
If MyMailMessage.IsEncrypted = True Then MyMailMessage = MyMailMessage.Decrypt()

When inside Using:
Using MyMailMessage As MailMessage = MailMessage.Load…
MailMessage = Read-Only Error
End Using
No other way to decrypt in place?

When converting Encrypted secure messages to each others’ format, ie eml to msg or msg to eml, the encryption and signatures will preserve in this way?

Using MyMailMessage As MailMessage = MailMessage.Load(Source, LoadOptions)
MyMailMessage.XMailer = …
Using MyMapiMessage As MapiMessage = MapiMessage.FromMailMessage(MyMailMessage, Mail2MapiOptions)
MyMapiMessage.Headers.Set…
MyMapiMessage.Save…

Note that I altered XMailer in both instances, this code will preserve the encryption certificates and signatures? (Assuming set in Load/Save options)

SecureEmailManager is not in online help :frowning:

Hi @australian.dev.nerds

Yes

Could you elaborate on the question with the full code and the full question. I suspect that you used the Encrypt method, but for a correct answer, I need to know exactly what you are doing.

Yes

Will be available after update API reference.

1 Like

Hi,
Thanks, my whole code:

Using MyMailMessage As Email.MailMessage = Email.MailMessage.Load("e.eml")

    MyMailMessage = MyMailMessage.Decrypt

End Using

Error: ReadOnly variable cannot be the target of an assignment.

Just was asking if there’s another usage to decrypt as well? :slight_smile:

Hi
Using MyMailMessage As Email.MailMessage = Email.MailMessage.Load(“e.eml”)

        Dim DecryptedMailMessage As Email.MailMessage = MyMailMessage.Decrypt
        DecryptedMailMessage.Save("d.eml")

    End Using

new instance of MailMessage can be used