Manage Learn to apply best practices and optimize your operations.

More control of message formatting

This application contains a script library that can easily be added to any application to give you more control over the format of your outgoing Lotus Notes/Domino mail messages.

View member feedback to this tip.

This application contains a script library that can easily be added to any application to give you more control over the format of your outgoing Lotus Notes/Domino mail messages -- including controlling the value of the 'From' field. You can set the value of the 'From' field to any desired value so the return address can be customized for each agent/script that sends e-mails. The script library also handles all necessary address book lookups, address resolutions and required mail router configuration values.

This is achieved by creating messages directly into the Domino server mail.box database just as you would create a document in any other database. This script library handles all the necessary access to the server/mail.box, formatting of the mail message and mandatory fields required by the Domino router, lookups to address books, conversion of addresses and even handling group names. All you need to do is tell the script who to send it to (SendTo, CopyTo and Blind CopyTo), add your subject and add content to the Body field using the standard Notes RichTextItem class methods.

This application can be used with Notes/Domino release 4.6x or higher.

You can download the free code here: http://www.agecom.com.au/mailscript


MEMBER FEEDBACK TO THIS TIP

Writing directly to mail.box was acceptable prior to 4.6 but since then has been officially marked off limits by the Lotus Development team. Starting in 4.6 there was an interesting behavior where Notes documents created directly in mail.box would be successfully saved, as verified by checking the return value of the save method. Some, but not all, of those documents would never actually be created in the database and the messages would simply evaporate or otherwise appear to never have existed.

At the time when I first noticed this, Lotus had posted warnings in multiple places on Notes.net that no end users should ever attempt to do this and that they were reserving the right to change anything they wished about how the database operated, even if it would break other people's applications. A further note stated that the filename was actually one of several like mail.box depending on how many the Domino server required for its operation. The official word was to stay out and to keep out.

The official way to spoof messages is to write to the Principal field. The drawback to this is that the user or server running the code always appears in the Sender field. As it happens, this is required by the RFC specification for e-mail headers -- that any software that sends on behalf of another user must identify the actual sender. I think this is an attempt by Lotus to stay with the spirit of the original specification and perhaps to keep people on the level with regards to unethical spoofing, like spam, perhaps.

The user who wishes to send messages anonymously requires the help of some other user or server to send the messages. A valid work around is to have a mail.box application replacement which polls for new documents and calls the .Send method on the server. The messages are delivered as normal but this allows you to substitute the Sender value from your email address to some other address.

At this point I would regard any and all tips that require writing to mail.box to be fatally flawed and not suitable for use in any production environments given the instabilities. Messages saved there may or may not be delivered, may or may not appear in the database, and the database filepath cannot be counted on to be correct.
—Joshua J.

******************************************

The MailScript script library is a fully supported product. Continuing development ensures compatibility with the various versions of Lotus Notes/Domino and takes advantage of new features added in newer releases. The script library handles multiple mailboxes on the Domino server without any problem -- as well as local mailboxes. It's an excellent add-on for any agent that sends automated email, especially on Web sites where your requirement is to be able to specify the sender/return address for each agent -- but all agents have been enabled by a single Notes ID.
—Alex Elliott, tip author

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Alex Elliott. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close