Server Smalltalk Guide

SMTP transport

The SMTP transport contains both client (send mail messages) and server capabilities (that is, it can both send and receive mail messages).

An SMTP URL takes the following form:

scheme:/smtp/user@host

The scheme and transport components have their standard meanings. The address consists of a user name and a host and port for the endpoint. The port is optional and defaults to the standard SMTP port (25). user is also optional but this makes sense only for local endpoints and will cause outgoing mail to have an anonymous return path. host, if not specified, defaults to the TCP address INADDRANY and also is only sensible for local endpoints.

While the contents of an SMTP message can be any collection of bytes, the transport itself uses a special SMTP header. For example:

| header body |
header := SstSmtpHeader parseHeaderFrom:
   'From: briand\To: jeff\Subject: test' addLineDelimiters.
body := 'This is a test'.
^SstCommunicationMessage header: header contents: body

The parseHeaderFrom: class method in SstSmtpHeader takes a String or a <readablePositionableStream>. Given a stream, it parses the SMTP header and leaves the stream positioned on the first line of the message. For SMTP purposes, SstCommunicationMessage and SstByteMessage can be used interchangeably.

The SMTP transport supports sending of mail through MX mail forwarders by redirecting messages through an SMTP smart host, usually a conventional mailing system. You configure it with the following system-wide setting:

SstSMTPCommunications smtpSmartHost: '<smart host name>'


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]