HTML Email from Clojure

As mentioned in my other post about plaintext emails, I recommend using the Apache Commons Email library when sending email from Clojure apps.  First up, you need to add the dependency to ‘project.clj’

Next, your HTML email has both an HTML version and the alternative plaintext version of the email. Notice, all you have to do is create an instance of HtmlEmail and then call the set and send methods on it using ‘doto’. Pretty easy.

There are more examples and the javadocs over at the Apache Commons site. However, this should be a basic enough example to get you started.

 

 

 

Plain Text Email from Clojure

I recommend using the Apache Commons Email library when sending email from Clojure apps. Here’s a simple example.

First up, you need to add the dependency to ‘project.clj’

Next, your code would look something like the following. Caution, … This will send emails, so configure it to send the emails to a personal email address for testing purposes.