Command Sending Mail, Overview

4D Internet Commands

Sending Mail, Overview

version 6.5


Simple Mail Transport Protocol (SMTP) is the mail standard used throughout the Internet. With 4D Internet Commands, developers can build simple mail messages with just one command, or complex messages with a series of commands. The SMTP commands enable developers to control all portions of a mail message, including Reply-To headers, Sender headers, Attachments, Comments, and References.

4th Dimension and 4D Internet Commands allow developers to create very powerful databases with the ability to send messages and attachments over the Internet. Some examples of how the suite of SMTP commands could enhance your databases are:

• Automation of sending reports or documents created within 4th Dimension.

• Databases could inform developers of special occurrences (i.e. ON ERR CALL("Mail_Error"))

• Databases could execute automated mailings to people across the country

There are an unlimited number of uses for the suite of SMTP commands. These commands, combined with those for POP3 (retrieving both files and attachments), FTP, and TCP provide the 4th Dimension developer with the tools to dramatically increase the communications capabilities of their 4D databases.

Two methods of Creating a Mail Message

Within the SMTP section of commands, there are two separate methods of sending electronic mail, which have previously been referred to as "simple" and "complex". The "simple" method involves a single command, SMTP_QuickSend, which accepts all the parameters necessary to address and send a message.

The majority of e-mail sent throughout the world is pretty simple in its construction; somebody "here" wants to send a "message" of some kind to somebody "there" regarding some "subject". If this were a paper letter, you would write everything up, seal and address the envelope and then take it to the post office for delivery. With SMTP_QuickSend, you can specify the "From", "To", "Subject" and "Message Body" within one command for easy e-mail delivery.

However, not all mail delivery can fit into such narrow parameters. For instance, suppose the letter above needed copies sent to other interested parties or perhaps an attachment such as your Annual Report needed to be enclosed. In these cases, photocopies of your letter would be made and reports printed as your staff collated the material and addressed the envelopes to each recipient. The SMTP commands in 4D Internet Commands simplify the electronic distribution by giving you control over all aspects of e-mail delivery. Multiple attachments, Carbon Copy & Blind Carbon Copy addressing, any mail header specification can be handled through the Built Message capabilities of the SMTP commands.

Understanding Mail Delivery

One of the critical concepts in understanding the SMTP commands relates to the method in which mail is delivered to its recipients. The SMTP commands do not directly deliver the mail to each recipient. The commands handle the proper composition and formatting of your mail and will deliver the results to the SMTP server specified by the SMTP_Host command. The SMTP server is often a machine within your own organization or at your Internet service provider. The SMTP server then resolves the optimum delivery path for your mail and schedules its distribution based on settings configured by the mail administrator.

Minimum Requirements to Send a complex SMTP Message

In order to successfully deliver a mail message built using the SMTP commands, the essential commands must all be correctly defined. The following commands represent the minimum in order for e-mail delivery to be successful:

SMTP_New

Creates the space in memory for the new message and returns a reference to be used in subsequent commands.

SMTP_Host

Specifies the SMTP server where the message will be delivered

SMTP_From

At least one address in this header

SMTP_To

At least one address in this header

SMTP_Send

Sends the message

SMTP_Clear

Clears any memory used during the creation of the message

If only the commands listed above were executed, a message would have been sent which contained no "Subject" definition and no message body. This isn't particularly useful and illustrates the need to specify additional detail in order to effectively communicate your message.