7 sendmail: Sending E-Mail

▼ |  | Net: Networking Libraries

1 | HTTP Client
2 | URLs and HTTP
3 | URI Codec: Encoding and Decoding URIs
4 | FTP: Client
5 | Send URL: Opening a Web Browser
6 | SMTP: Sending E-Mail
7 | sendmail: Sending E-Mail
8 | Headers: Parsing and Constructing
9 | Header Field Encoding
10 | IMAP: Reading Mail
11 | POP3: Reading Mail
12 | MIME: Decoding Internet Data
13 | Base 64: Encoding and Decoding
14 | Quoted-Printable: Encoding and Decoding
15 | DNS: Domain Name Service Queries
16 | NNTP: Newsgroup Protocol
17 | TCP: Unit and Signature
18 | TCP Redirect: tcp^ via Channels
19 | SSL Unit: tcp^ via SSL
20 | CGI Scripts
21 | Cookie: Legacy HTTP Client Storage
22 | Git Repository Checkout
| Bibliography
| Index

► | 7 | sendmail: Sending E-Mail

7.1 | Sendmail Functions
7.2 | Sendmail Unit
7.3 | Sendmail Signature

On this page:

7.1 Sendmail Functions
send-mail-message/ port
send-mail-message
7.2 Sendmail Unit
sendmail@
7.3 Sendmail Signature
sendmail^

top contents ← prev up next →

## 7 sendmail: Sending E-Mail🔗ℹ

(require net/sendmail) | package: net-lib

The net/sendmail module provides tools for sending electronic mail messages using a sendmail program on the local system. See also the net/smtp package, which sends mail via SMTP.

All strings used in mail messages are assumed to conform to their corresponding SMTP specifications, except as noted otherwise.

### 7.1 Sendmail Functions🔗ℹ

> > procedure
> > (send-mail-message/port |  | from |  |  |  |
> > |  | subject |  |  |  |
> > |  | to |  |  |  |
> > |  | cc |  |  |  |
> > |  | bcc |  |  |  |
> > |  | extra-header ...) |  | → |  | output-port?
> from : (or/c string? #f)
> subject : string?
> to : (listof string?)
> cc : (listof string?)
> bcc : (listof string?)
> extra-header : string?

The first argument is the header for the sender, the second is the subject line, the third a list of “To:” recipients, the fourth a list of “CC:” recipients, and the fifth a list of “BCC:” recipients. All of these are quoted if they contain non-ASCII characters.

> > > Note that passing already-quoted strings would be fine, since then there are no non-ASCII characters.

Additional arguments argument supply other mail headers, which must be provided as lines (not terminated by a linefeed or carriage return) to include verbatim in the header.

The return value is an output port into which the client must write the message. Clients are urged to use close-output-port on the return value as soon as the necessary text has been written, so that the sendmail process can complete.

The from argument can be any value; of course, spoofing should be used with care. If it is #f, no “From:” header is generated, which usually means that your sendmail program will fill in the right value based on the user.

> > procedure
> > (send-mail-message |  | from |  |  |  |
> > |  | subject |  |  |  |
> > |  | to |  |  |  |
> > |  | cc |  |  |  |
> > |  | bcc |  |  |  |
> > |  | body |  |  |  |
> > |  | extra-header ...) |  | → |  | void?
> from : string?
> subject : string?
> to : (listof string?)
> cc : (listof string?)
> bcc : (listof string?)
> body : (listof string?)
> extra-header : string?

Like send-mail-message/port, but with body as a list of strings, each providing a line of the message body.

Lines that contain a single period do not need to be quoted.

### 7.2 Sendmail Unit🔗ℹ

> > > sendmail@ and sendmail^ are deprecated. They exist for backward-compatibility and will likely be removed in the future. New code should use the net/sendmail module.

(require net/sendmail-unit) | package: compatibility-lib

> value sendmail@ : unit?

Imports nothing, exports sendmail^.

### 7.3 Sendmail Signature🔗ℹ

(require net/sendmail-sig) | package: compatibility-lib

> signature sendmail^ : signature

Includes everything exported by the net/sendmail module.

top contents ← prev up next →