« Wasted a few hours on this, so I don't forget in the future and to save someone else some pain I'll make this post | Main| This took me by surpise, and not in a nice way. »

Looking for assistance...Yes for a change I'm asking the questions :-)

Category

In an agent being called by a web user I am generating a MIME email.  All works great, email looks great.  The issue is, I cannot get the Principal field to work with a MIME email.
I am Doing this:
        doc.Principal = "CN=John Brown/OU=US/O=Epilio@Notesdomain"
But the mail still doesn't come from John.  I can change the replyto field etc. just that Principal doesn't stick.

Searching the notes forum there have been some people suggest you can't do this with a MIME email, can anyone confirm if this is true, I'm really hoping it isn't as my email formatting will be totally screwed up.

Thanks for any help anyone can provide.


Also whilst I'm on the subject, we shouldn't have to do this voodoo with Principal fields and such.  It should be a simple lotusscript function call to override this stuff.

Update: Thanks everybody, I ended up writing to the mail.box.  I don't like doing it, but I couldn't find any other way.  I'll chalk it up as one of those Domino quirks, that makes us love it so much.

Comments

Gravatar Image1 - I remember one of my client had this problem as well and sent me the solution. Unfortunately, it is on my second computer at home :) But as far as I remember he finally put the principal field in a header of the MIME mail? Something like this, I'll try to check at home this evening.

Gravatar Image2 - I thought that this was all down to the Notes security model. As such, the only way you'd get around that is writing the MIME email directly to the server's mail.box file, rather than trying to route it the normal way.

But I could be wrong, I've not done much with this stuff!

Gravatar Image3 - Try adding an InetFrom field and populating it with the same value as your Principal field.

Gravatar Image4 - I've struggled with this problem, and come to the conclusion that the only solution is to write directly into the server's mail.box. I based my code on the code found in this template:

{ Link }

and it has worked great.

Gravatar Image5 - Ok ... writing directly to the mail.box is a hack ... to get past the serialization and security model presented by Notes. If you want the Principal field to be dynamic, you are kinda screwed, and the "hack" is one way to do it, the other is to use java to open an SMTP session to send the mail through to the domino server via SMTP, skipping the notes router and subsequently the serialization/security. If the principal email address is staic for the agent, create a new notes user with a notes ID, set the email address in the person document in the NAB, and sign the agent with that ID (remember to give that ID any appropriate access required, ie run background agents, etc) ... that will cause the domino router on the server to translate the notes user name to the email address in the person document when the email leaves the notes domain.

Gravatar Image6 - No great insights on the MIME aspect of the question, but I will say that the "hackiness" of the mail.box solution is imho minimal because a) it is already written (see Domino Team Mailbox on OpenNTF as @4 Stuart has suggested), and b) in pretty wide use at this point. I use it for the same reason that DTMB uses it, which is to ensure truly anonymous outbound messages (i.e. none of that From: "Customer Support" Sent by: Kevin Pettitt nonsense).

Gravatar Image7 - @5 sadly, the email from address is being picked from a picklist, so I can't create a special ID. Looks like I'll be writing to the Mail.box.

Does anyone know why this works for regular notes mail in agents, but not MIME mails?

Gravatar Image8 - For normal emails you can use the Principal without any problems, you are just not allowed to use the From field.
Also with the direct writing to mail.box I remember there was some change (version 7 or 8?) that it shouldn't support mails with attachments anymore. Have no idea why.

Gravatar Image9 - If you add the Principal after you have closed the MIME stream then it should work.

Gravatar Image10 - @9 Thanks Glen. I have it working now with the writing to mail.box, but I will cycle back and check out doing it after I close the MIME stream. Thanks

Gravatar Image11 - I finally found the trick my customer sent me a years ago (it was for version 5).

set mimeBody = doc.CreateMimeEntity( "Body")
set headerBody = mimeBody.CreateHeader( "InetFrom")
call headerBody.SetHeaderVal( "youremail")

And the same was necessary for Subject field as well.

Looking forward for your solution.

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::rolleyes:;-)