Introduction

Language Structure

IB Statements

File System

Comet 32 Runtime

Index

Sending e-mail via SMTP

 

Simple Mail Transport Protocol

 

Simple Mail Transport Protocol (SMTP) was defined in the early 1980's as a reliable and efficient way to send Internet e-mail. Today, SMTP is the worldwide standard protocol for Internet-based e-mail systems.

 

The full definition of SMTP is available in RFC 821 (available at http://signature.net/rfc/rfc821.txt).

 

Note: There are two protocols that govern Internet e-mail systems. SMTP is the protocol for sending e-mail, while Post Office Protocol Version 3 (also known as POP3) is the protocol for retrieving e-mail from a mail server. This document and the related demo programs cover SMTP only.

 

A simple SMTP session starts with the following four SMTP commands, shown here in the context of an Internet Basic program printing them to the Winsock gateway:

 

PRINT (lun) "HELO domain-name"

PRINT (lun) "MAIL FROM: address1"

PRINT (lun) "RCPT TO: address2"

PRINT (lun) "DATA"

PRINT (lun) ""

 

Where domain-name identifies the system sending the e-mail (but whose value is not verified by either the sending or receiving machine and therefore can have virtually any value), address1 is the e-mail address of the sender, and address2 is the e-mail address of the recipient (the e-mail addresses are in the form name@domain).

 

Note: A blank line printed after these four commands makes the message readable by virtually all e-mail clients.

 

To send the message to multiple recipients, print multiple "RCPT TO:" commands to the Winsock gateway, as follows:

 

PRINT (lun) "HELO domain-name"

PRINT (lun) "MAIL FROM: address1"

PRINT (lun) "RCPT TO: address2"

PRINT (lun) "RCPT TO: address3"

PRINT (lun) "RCPT TO: address4"

PRINT (lun) "RCPT TO: address5"

PRINT (lun) "DATA"

PRINT (lun) ""

 

Following the DATA command, your program can print the e-mail message itself, which consists of headers, text, and whatever else makes up the content of the message (e.g., attachments, a vCard, etc.). These items are described below.

 

Once the e-mail content has been printed, your program must print the final SMTP command, which is a period on a line by itself (following a blank line), as follows:

 

PRINT (lun) ""

PRINT (lun) "."

 

Here is the summary of the steps that have been described so far.

 

 

The sequence of events looks like this:

 

CONNECT SMTP-server MAIL

HELO domain-name

MAIL FROM: address1

RCPT TO: address2

DATA

 

E-mail headers, text, etc.

(blank line)

.