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.
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.
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
Reference Library Applications
Design Enhancements Using LotusScript
Design Enhancements Using Formula Language
Miscellaneous Enhancements and Tips for Domino Databases
Application Deployment and Maintenance
Appendix A. Online Project Files and Sample Applications
Appendix B. IBM® Lotus® Notes® and Domino®Whats Next?