Easy mail interface. Example:
(send-mail 'From: "Dr. Watson <guest@grimpen.moor>"
'To: "Sherlock Homes <not-really@221B-baker.street>"
'Subject: "First Report"
'Charset: "ISO-8859-1"
'Body: "Moor is gloomy. Heard strange noise, attached."
'Attachments: '((File: "howl.ogg")))
This tries very hard to do The Right Thing.
More specifically, the body and headers are all properly MIME-encoded
for the given Charset (which may alternately be specified in
Content-Type), choosing the whichever of base64 and quoted-printable
would encode with the smallest size. Source strings are all assumed
to be UTF-8 and charset encoded as needed.
Attachments are arbitrarily nested lists of the same keyword
parameters as in the main send-mail parameters, and are sent as
multipart MIME encodings (i.e. any valid parameter list to send-mail
could also be used in an Attachments: list). Attachments inherit,
but may override, their parents' Charset settings.
Most standard mail headers are recognized as keyword arguments,
always titlecased (e.g. Cc:, Message-Id:, Mime-Version:) for a
friendly mail-like interface. Additional headers may be specified in
the Headers: keyword, for example
Headers: '(X-Foo: "bar" X-Baz: "qux")
The parameters To:, Cc: and Bcc: may also be lists of addresses which
will be properly comma-delimited.
You can tell send-mail *not* to perform character encoding
conversions by passing the Charconv: #f keyword argument, and
likewise disable automatic MIME encoding of message bodies by passing
Encode: #f, in which case you are responsible for ensuring the
literal text matches with the given Content-type and
Content-Transfer-Encoding.
If you just want to send a raw message without any processing at all,
you can pass an input-port to the Source: parameter
(send-mail 'To: addresses 'Source: (open-input-file "message.txt"))
By default send-mail connects to the local smtp port, however you can
override this with the Host: parameter to use a particular server.
Alternately, if you specify Host: #f then send-mail will look up the
appropriate DNS entries for all recipients and send to them in turn.
send-mail returns the list of recipients who couldn't be delivered to
(i.e. a null list when there are no errors).