Generate Email Using Formula Language

There are essentially two methods that can be used to generate an email using Formula Language@Command ([Mailsend]) and @MailSend. The @Command([Mailsend]) statement is used to send the current document to a list of recipients. @MailSend, on the other hand, is used to create and send a custom email message.

How It Works

The @Command([Mailsend]) command generates an email based on the current document. This statement is typically added to an action button on a form. This approach also requires the form to include a field called SendTo. This field must contain a valid list of one or more email addresses. Optionally, the form can also include Subject, CopyTo, and BlindCopyTo fields.

The @MailSend function sends a custom email message based on function call parameters instead of using field values on the document. With this approach, the email is generated by specifying the list of recipients, subject, and body information within the function. When executed, the function sends a message to all recipients listed in the SendTo, CopyTo, and BlindCopyTo fields. Like its counterpart, this function is also typically placed in an action button on the form. When clicked, the message is sent.


You may want to save and close the document after either button is pressed. This is achieved by appending @Command([FileSave]) to save the document and @Command([FileCloseWindow]) to close the document.


ImplementationExample 1

To implement the @Command([Mailsend]) approach, create a form that includes the SendTo and Subject fields. Next, create an action button and insert the following formula in the Programmer's pane. When clicked, the @Mailsend statement retrieves the field values from the document and sends the email message to the recipient list.

@Command ([MailSend])


ImplementationExample 2

To implement the @MailSend approach, create an action button and insert the following formula. Be sure to adjust the SendTo value to reflect all intended email recipients as well as the subject line.

SendTo := @UserName;
CopyTo := "";
BlindCopyTo := "";
Subject := "This is a sample email";
Remark := "";
BodyFields := "This is the body of the email.";
Flags := "";
@MailSend(sendTo ; copyTo ; blindCopyTo ; subject ; remark ; bodyFields ; Flags);
@Prompt([Ok]; "Success"; "Message sent.");

How to Sort a List of Values

An Introduction to the Lotus Domino Tool Suite

Getting Started with Designer

Navigating the Domino Designer Workspace

Domino Design Elements

An Introduction to Formula Language

An Introduction to LotusScript

Fundamentals of a Notes Application

Calendar Applications

Collaborative Applications

Reference Library Applications

Workflow Applications

Web Applications

Design Enhancements Using LotusScript

Design Enhancements Using Formula Language

View Enhancements

Sample Agents

Miscellaneous Enhancements and Tips for Domino Databases

Data Management


Application Deployment and Maintenance


Appendix A. Online Project Files and Sample Applications

Appendix B. IBM® Lotus® Notes® and Domino®Whats Next?

Lotus Notes Developer's Toolbox(c) Tips for Rapid and Successful Deployment
Lotus Notes Developers Toolbox: Tips for Rapid and Successful Deployment
ISBN: 0132214482
EAN: 2147483647
Year: N/A
Pages: 293
Authors: Mark Elliott © 2008-2020.
If you may any questions please contact us: