MIMEHeader vs SendTo

Friday, May 8, 2020 at 1:50 PM UTC

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?





Latest comments to this post

Frank Paolino wrote on 22.05.2020, 23:45

I had a similar problem. When Notes/Domino gets its hands on it, it looks at the field Principal and always uses that in computing the from, probably because that preceded the name@domain.com format and is baked into the outbound SMTP send?

 Link to this comment
Oliver Busse wrote on 13.05.2020, 10:43

Karsten, I didn't try this from the client, yet. This script is executed on the server, no client or user interaction involved.

 Link to this comment
Karsten Lehmann wrote on 09.05.2020, 00:23

Have you had any success creating an email with MIME To headers in the mail.box of the Notes Client?

In my tests, Notes was unable to send this email out.

 Link to this comment
Ben Langhinrichs wrote on 08.05.2020, 17:22

The Domino router uses Notes items such as SendTo and CopyTo (as well as some variants such as $INETSendTo) to determine where things go, whether from server to server or out to the Internet. I guess that could be considered "old-fashioned", but fundamentally, the MIME parts are just content to be moved around. The router will use the Notes items to look up or calculate the correct MIME information as mail moves out of the system. If you set that in the MIME, you are taking over the job of looking up addresses and so forth. We do both sorts in our CoexLinks Fidelity product. but we also handle all the name lookups and so forth when necessary.

 Link to this comment
Jesper Kiaer wrote on 08.05.2020, 17:01

My best bet would be: When using MIME, you are the one responsible for the stuff you inside the MIME header, Domino does not care, just sends it off. When you use the "old way" Domino will lookup the person in the NAB, and check whether it should be routed inside the Notes domain (keep the Notes name) or outside (use internet naming format)     

 Link to this comment

Leave a comment right here