Dear Cregg: I am sending email messages from a Domino Web application, which features an @Mailsend command behind a button. The email messages are being sent properly, except when an anonymous user sends a message using this application. In such a case, the sender appears as: firstname.lastname@example.org. How can I customize this and set the sender field?
To accomplish what you want, you have to set the principal field of the outgoing email messages. This is easier to do in LotusScript than Formula language. In LotusScript, to send a minimal email, you could use something like this:
Dim Session As New NotesSession Dim db As NotesDatabase Set db = session.CurrentDatabase Dim email As NotesDocument Set email = db.CreateDocument email.form="Memo" email.principal="My Favorite User" email.subject="subject" email.body = "body" Call email.Send(False,"Addressee or array of addressees")
In Formula language, it's a little trickier. You cannot set field contents directly. Instead, you pass them to @Mailsend as arguments. If @Mailsend does not have the argument you need, then you have to have the value set in the Lotus Notes document before you send it, and then use the @Mailsend parameter that causes certain fields to be included. Depending on your application, this may or may not be practical.
If your Domino Web application is creating a document, and that document is the one that contains the button and that is being sent out, then simply add a computed field called principal to the form. Give this field a formula to set its value to the readable value you would like. Be sure to note that in Lotus Notes, this value does not have to correspond to a real, addressable user. But if it doesn't, make sure you also add a "Replyto" field which does.
Now to your @mailsend command, add the "bodyfields" argument to tell it to include the principal and "Replyto" fields calculated when the document is created:
@MailSend( "sendTo" ; "" ; "" ; "subject" ; "remark" ; "principal":"replyto" )
Do you have comments on this Ask the Expert Q&A? Let us know.
Related information from SearchDomino.com:
Dig Deeper on LotusScript
Related Q&A from Cregg Hardwick
A user wants to know if it's possible for LotusScript to read an attachment in a Notes document without first detaching it. Find out our expert's ... Continue Reading
Read about merging cells in a Microsoft Word table using LotusScript and an Excel example, along with the thought process that goes along with it. Continue Reading
Discover some LotusScript code that can be implemented to forward Lotus Notes email messages at specific times. Continue Reading