5 SMTP: Sending E-Mail
The net/head library defines the format of a header string, which is used by send-smtp-message. The net/head module also provides utilities to verify the formatting of a mail address. The procedures of the net/smtp module assume that the given string arguments are well-formed.
5.1 SMTP Functions
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
server-address : string? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
from : string? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
to : (listof string?) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
header : string? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
message : (listof (or/c string? bytes?)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
port-no/k : (integer-in 0 65535) = 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
user : (or/c string? false/c) = #f | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pw : (or/c string? false/c) = #f | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
port-no : (integer-in 0 65535) = port-no/k |
The header argument is the complete message header, which should already include “From:”, “To:”, and “CC:” fields consistent with the given sender and recipients. See also the net/head library for header-creating utilities.
The message argument is the body of the message, where each string or byte string in the list corresponds to a single line of message text. No string in message should contain a carriage return or linefeed character.
The optional port-no argument – which can be specified either with the #:port-no keyword or, for backward compatibility, as an extra argument after keywords – specifies the IP port to use in contacting the SMTP server.
The optional #:auth-user and #:auth-passwd keyword argument supply a username and password for authenticated SMTP (using the AUTH PLAIN protocol).
The optional #:tcp-connect keyword argument supplies a connection procedure to be used in place of tcp-connect. For example, use ssl-connect to connect to the server via SSL.
If the optional #:tls-encode keyword argument supplies a procedure instead of #f, then the ESMTP STARTTLS protocol is used to initiate SSL communication with the server. The procedure given as the #:tls-encode argument should be like ports->ssl-ports; it will be called as
(encode r w #:mode 'connect #:encrypt 'tls #:close-original? #t)
and it should return two values: an input port and an export port. All further SMTP communication uses the returned ports.
For encrypted communication, normally either ssl-connect should be supplied for #:tcp-connect, or ports->ssl-ports should be supplied for #:tls-encode – one or the other (depending on what the server expects), rather than both.
(smtp-sending-end-of-message) → (-> any) |
(smtp-sending-end-of-message proc) → void? |
proc : (-> any) |
5.2 SMTP Unit
(require net/smtp-unit) |
smtp@ : unit? |
5.3 SMTP Signature
(require net/smtp-sig) |
smtp^ : signature |
Includes everything exported by the net/smtp module.