Can not encrypt emails from mail-in db

Hello, everyone,

I am looking for help with a problem with programming Notes from a VBA program. I use the “Notes.NotesSession” COM object to send emails that are generated on the fly to a long list of recipients. That works quite well. However, my client wanted to encrypt the emails and that does not work.

As I said, sending the emails works fine. But as soon as I insert "MailDoc.ReplaceItemValue “Encrypt”, “1"” into the program code I get an “automation error” from the Notes COM object. If I use my own mail db encrytion works fine, but as soon as I try to send from the mail-in db that should be used as the sender it does not work.

So the following works

Set MailDB = Session.GetDatabase(“”, “”) ’ Get default DB for current user

If Not MailDB.IsOpen Then _
MailDB.OpenMail

Set MailDoc = MailDB.CreateDocument

MailDoc.Form = “Memo”

MailDoc.SendTo = Recipients

MailDoc.Principal = “mailindb@mycompany.com@MyNotesDomain

MailDoc.SendFrom = “mailindb@mycompany.com

MailDoc.Subject = Subject

MailDoc.Body = BodyText

MailDoc.SaveMessageOnSend = True

MailDoc.ReplaceItemValue “Encrypt”, “1”

MailDoc.PostedDate = Now()

MailDoc.Send 0

While this does not work:

Set MailDB = Session.GetDatabase(“MailInDBServer”, “MailInDbName”) ’ Only this has changed

If Not MailDB.IsOpen Then _
MailDB.OpenMail

Set MailDoc = MailDB.CreateDocument

MailDoc.Form = “Memo”

MailDoc.SendTo = Recipients

MailDoc.Principal = “mailindb@mycompany.com@MyNotesDomain

MailDoc.SendFrom = “mailindb@mycompany.com

MailDoc.Subject = Subject

MailDoc.Body = BodyText

MailDoc.SaveMessageOnSend = True

MailDoc.ReplaceItemValue “Encrypt”, “1”

MailDoc.PostedDate = Now()

MailDoc.Send 0

I do not have the slightest idea why it does not work and I can not find anything about this on Google. I think it should work. The mail-in db does not have a certificate but that is not necessary since the encryption needs the certificate of the recipient, not of the sender and all of the recipients do have a certficate.

All the email addesses in the variable “Recipients” are of the form “[FirstName].[LastName]@mycompany.com”. I also tried “MailDoc.EncryptOnSend = True” but that led to the very same error message.

Any help would be greatly appreciated.

Frank