Skip to content

some simple cl-smtp examples

The docs on cl-smtp are a little, um, terse, so I figured I’d post a few snippets for google to find:

Sending html email with cl-smtp:

Shiny <strong>h</strong><em>t</em><small>m</small>l.
 :extra-headers '(("Content-type" "text/html; charset=\"iso-8859-1\"")))

Sending attachments with cl-smtp:

 "see attachement"
 :attachments '("/path/to/attachment"))

Ok, back to my regularly scheduled slog.


  1. Boomer wrote:

    Thanks! I’ve been googling for something like this. Your timing is perfect.

    Friday, October 31, 2008 at 12:47 pm | Permalink
  2. Hans’ BKNR branch of CL-SMTP has some additional MIME attachment features:

    And here’s an utility library for sending UTF-8 mail:



    Saturday, November 1, 2008 at 4:44 am | Permalink
  3. Alejandro Atienza Ramos wrote:

    It would be perfect to complement it with how to download mail from the same email account, although, obviously, not with smtp…

    Sunday, November 2, 2008 at 6:19 pm | Permalink
  4. Victor wrote:

    This tip could be contributed to the “Common Lisp” Wikibook, section “Libraries”.

    Monday, November 3, 2008 at 9:32 am | Permalink
  5. JC wrote:

    AFAIK, all cl-smtp(old, new, forked, etc) implementation do not handle encoding subject and content correctly(or hard to use). In my mind, the correct implementation should use Flexi stream to deal with different encodings for the content at least

    Wednesday, November 5, 2008 at 6:54 pm | Permalink
  6. Jeff Cunningham wrote:

    Hi – Google found your snippets on cl-smtp (thanks!). I’m trying to figure out why attachments don’t work and wondering if a bug has crept into the code since you posted this. Would you mind trying your example and letting me know if it still works for you? Mine generate this error:

    [Condition of type SMTP-PROTOCOL-ERROR]
    Jeff C.

    Thursday, February 28, 2013 at 6:48 pm | Permalink

One Trackback/Pingback

  1. […] Ryepup gave us a great couple of simple examples for CL-SMTP.  Unfortunately when I tried to combine them to send an HTML email that had an attachment, I did not get the expected results.  Instead, we insert an inappropriate ContentType header above the multipart then the message body has content type text/plain.  I saw Leslie Polzer’s comment about a BKNR branch of cl-smtp that handled mime-types better.  So I downloaded it, fired it up, bound the content-type variable and it almost produced the correct email.  Unfortunately the result email was missing a newline after the header so my client skipped displaying this first email part (assuming it to be part of the header).  I submitted a patch, that was accepted, that adds the newline after the multipart message header. […]