Today I encountered a strange behavior when sending mails and using different ways to define the recipient. The first example defines the recipient by adding the "To" header to the MIME root:
MIMEEntity emailRoot = emailDocument.createMIMEEntity("Body");
MIMEHeader emailHeader = emailRoot.createHeader("To");
emailHeader.addValText("Oliver Busse/We4IT", "UTF-8");
This will add me as the recipient using the Notes name as the recipient. Then this mail is sent outside of our domain (in our case this ends up being a mail in O365). The O365 address is used because we have a forwarding address defined in our person doc - in this case this is a @onmicrosoft.com address.
The mail in my inbox is displayed like this:
As you can see, the Notes name is still being displayed and Outlook is not able to work with.
The header looks like this:
MIME-Version: 1.0 Auto-Submitted: auto-generated From: Oliver Busse <Oliver.Busse@We4IT.com> To: Oliver Busse/We4IT Message-ID: <OFADA5F4BC.79FEEA99-ONC1258562.005194A5-C1258562.005194A5@We4IT.com>
The second example just uses the document field to define the recipient:
Document
emailDocument
= db.createDocument();
emailDocument
.replaceItemValue("SendTo", "Oliver Busse/We4IT");
emailDocument
.send();
The mail also is routed correctly but displayed like this:
The header looks like this:
Auto-Submitted: auto-generated From: Oliver Busse <Oliver.Busse@We4IT.com> To: Oliver.Busse@we4it.onmicrosoft.com Message-ID: <OFE0273FA9.2AD3BBF6-ONC1258562.005194A6-C1258562.005194A6@We4IT.com>
You can see, the address is resolved where for the first mail it isn't. I don't have an explanation, yet, but maybe you have one? Please tell me in the comments or send me a note! Thank you!
Update
I found this https://stackoverflow.com/questions/48664748/sending-mime-mail-from-domino-agent-multiple-instances-of-to-field and the term "old fashioned way" in one of the responses makes me think about the first example. What do you think?