FROM and PRINCIPAL fields not correct

I am trying, and have successfully before, to override the standard fields on an email sent by an agent. The Agent is signed by me, which I want to hide. This is the code:

Set docReply = db.CreateDocument

Call docReply.AppendItemValue(“Form”, “Memo”)

Call docReply.ReplaceItemValue(“SendTo”, tMail)

Call docReply.ReplaceItemValue(“From”, “Admin User <” & AdminAddr & “>”)

Call docReply.ReplaceItemValue(“Principal”, “Admin User <” & AdminAddr & “>”)

Call docReply.ReplaceItemValue(“Subject”, “Test”)

Set rt = New NotesRichTextItem(docReply, “Body”)

Call rt.AddNewline(2)

Call rt.AppendText(“some text”)

Call docReply.Send(False)

Call debugLog.LogAction(docReply.GetItemValue(“Principal”)(0))

========

The From field on the form has this formula:

FIELD Principal := @GetProfileField(“CalendarProfile”; “Owner”);

FIELD $LangPrincipal := @GetProfileField(“CalendarProfile”; “$LangOwner”);

FIELD $AltPrincipal := @GetProfileField(“CalendarProfile”; “AltOwner”);

@UserName

========

The agent log shows the Principal and From values as being exactly what they should be. However, the received email has a Principal value like:

George_Owen/Gbg/IBM%IBMPTT@millvale.ibm.com

I am going blind trying to figure this out. Any suggestions on what I am missing? The agent is kicked off in response to new documents, so debugging is a bit difficult without changing the runtime environment.

Subject: It’s not intended that email should be anonymous…

…and so the mail system’s Send function “corrects” the Principal field if it has the wrong value.

If you deposit the note directly into the mail.box you bypass that step. I think it’s still possible to tell where it came from, but it doesn’t appear on the recipient’s screen by default.

Subject: Darn that Send function

I know, a mail system that allows you to completely change your identity dynamically would be a bit of a security concern. However, I did manage to improve the process by creating the mail body as a MIME structure. I didn’t create any items except for ‘Form’. Doing it this way resulted in two PRINCIPAL fields on the received email, both with the value I inserted, and a From field containing an invalid email address based on my name. This is certainly good enough, as a Reply will correctly go to where it should, even if the Sender appears to be someone from another planet.

Subject: Setting the from address to whatever you want

We have just what you need. Our MailScript Script library was developed exactly for this sort of thing! It’s perfect for agents that send out automated notifications and for any other type of message where you want to control the ‘From’ address and set it to whatever you want…in your case it would be the return address for the database.

The Script library handles all the mail message formatting. All you need to do is supply the following information:

  • Subject

  • Recipients

  • From (sender name / address)

  • Content

You don’t need to set the ‘Principal’, 'ReplyTo, or any other fields. The ‘From’ address will be set to exactly what you want.

It’s freely available and can be downloaded from our website at:

The downloaded file comes complete with the script library and a fully functional mailfile which uses the script library demonstrating how to use it.

Hope this helps!

Alex