(chibi net smtp)

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).

(domain-part addr)

(local-part addr)

(parse-mail-address-list str)

(smtp-get-response smtp)

(smtp-open host [port from-host debug?])

(smtp-close smtp)

(smtp-helo smtp . o)

(smtp-mail smtp . o)

(smtp-rcpt smtp . o)

(smtp-data smtp . o)

(smtp-reset smtp . o)

(smtp-verify smtp . o)

(smtp-expand smtp . o)

(smtp-help smtp . o)

(smtp-quit smtp . o)

(smtp-noop smtp . o)

(smtp-starttls smtp)

(smtp-mail-from smtp address)

(smtp-recipient smtp address)

(smtp-generate-boundary)

(smtp-generate-msgid)

(send-mail . args)

(smtp-write-message port . keys)

(mime-choose-encoding str)

(mime-encode-header name val charset [nl])

(smtp-write-headers port . args)

(smtp-write-mime-part port . args)