Posted by: Patrick | November 1, 2007

Principal Suspect


Given a scenario when your database is supposed to send out email notifications which when replied to would automatically send it to a given email account, I’ve always thought the straightforward use of the Principal would suffice. That is, the given code should do the trick:

doc.Principal = “johndoe@acme.com”

But it doesn’t. If you have that LS code within a design element, say a button on a form, and a certain Jane Doe does the clicking, the email sent still shows Jane Doe’s name in the From field. Now that’s bad.

The first thing for me to try was to set every Memo field where Jane Doe appears to johndoe@acme.com. Tough luck though as Jane Doe’s email address still shows up in the notifications’ From field. Unfortunately, setting the From field manually didn’t do it because from inspection of the design of 6.5 mail databases from where I am, the said field is computed when composed!

Next was to rummage through the forums hoping that something would eventually pop up there. A little over half an hour it did!

The first thing I encountered was the Agent Troubleshooting Guide by Julie Kadashevich. In that long list of helpful tips, there’s a section, How can I change the apparent sender of agent generated mail?, discussing three ways to programmatically set a notification’s entry for the Sender.

Apparently there are three ways to set the Principal field in emails. From the Guide, these are:

  1. doc.Principal=”Joe User/Org@NotesDomain” where Joe User/Org has a Person record with an InternetAddress of your choosing. (Note that the string @NotesDomain must be present.)
  2. doc.Principal=”CN=Joe User/O=Org” where Joe User/Org has a Person record with an InternetAddress of your choosing.
  3. doc.Principal=User@acme.org@NotesDomain . (Note that the string @NotesDomain must be present.)

But any method there still didn’t get it done though. Other mail clients still continue to display Jane Doe in the From field.

Fortunately then, this forum response points me to somewhere I should’ve looked at before. In his blog entry, Notes/Domino hotshot Jake Howlett writes in his blog about the lines of code that would eventually work for me:

doc.Principal = “John Doe <johndoe@acme.com@NotesDomain>”
doc.InetFrom = “John Doe <johndoe@acme.com>”

I never bothered to check there before in the first place because troubles with the field was the last thing I would expect from Jake. What more about a reason to find time to write about something supposedly easy?

Anyway I would recommend reading that blog entry as it clears up a lot of Principal-related stuff from the guide.

Advertisements

Responses

  1. Notes/Domino “hotshot”. I like it ;o)

  2. an understatement really but what can I do? i’ve got a good hunch that the “legend” monicker sounded stale way, way back then.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: