Fork me on GitHub
#clojure-uk
<
2020-04-23
>
dharrigan06:04:37

Good Morning!

dharrigan06:04:39

We use Kotlin extensively at work. We like it a lot.

Conor08:04:18

The difference between Kotlin and Groovy is that the former doesn't make you want to tear your hair out

alexlynham09:04:28

I wondered how long after the mention of kotlin conor would appear

Conor10:04:19

It's good though

dharrigan14:04:26

Anyone got any recommends for sending email via aws ses?

dharrigan14:04:31

Postal only supports Java 8

alexlynham14:04:19

write a lambda that does it for you then call that over HTTP?

alexlynham14:04:31

that's probably what I'd do tbh

dharrigan14:04:18

Thanks for the suggestion 🙂

alexlynham14:04:06

cos then you can use the python/JS SDKs which are the ones aws seems to care about maintaining the most

dominicm14:04:00

Isn't the SES api pretty simple? I seem to recall not using a lambda.

dominicm14:04:19

Maybe the cognitect api supports it?

4
alexlynham14:04:18

oh yeah I mean you can obviously call it directly

alexlynham14:04:55

I just mean it depends on how flexible you wanna be/ how you wanna call it; the most generic way to abstract it is probably logic you control yourself via a lamda nano service

alexlynham14:04:08

thoooooooooooooooooooo that could well be overkill

dharrigan15:04:20

Ended up using amazonica

dharrigan15:04:18

(ses/send-email creds :destination {:to-addresses [""]} :source "" :message {:subject "Hello World!" :body {:text "Hello World!"}})

dharrigan15:04:22

works a charm

dharrigan15:04:46

The cognitect apis are quite low-level, it exposes the RawEmail API, but then you have to construct a byte body etc.. etc...

Ben Hammond15:04:17

not for simple text-only emails (like your example)

Ben Hammond15:04:28

I've never tackled attachements though

Ben Hammond15:04:13

meh I would post a code snippet, but I'm booted into Windows and I don't have access to t'other dev env

dharrigan16:04:08

Oooh, well, if you could at some point that would be appreciated 🙂

dharrigan16:04:21

I booted into Windows too, to have a quick game of Doom 2016...

Ben Hammond18:04:01

something like this...

(def aws-connection
  (delay (aws/client {:api :email
                      :version "2012-06-01"
                      :region :eu-west-1
                      :credentials-provider (credentials/basic-credentials-provider
{:access-key-id ""                                               :secret-access-key ""})})))

(defn send-email-over-ses
  [awscli {:keys [from to subject body]}]
  (aws/invoke awscli
    {:op :SendEmail
     :request {:Source from
               :Destination {:ToAddresses to}
               :Message {:Subject {:Data subject}
                         :Body {:Text {:Data body}}}}}))

Ben Hammond18:04:35

where

(:require [cognitect.aws.client.api :as aws]
          [cognitect.aws.credentials :as credentials]

Ben Hammond18:04:06

But I never opened the can of worms to make attachments work

dharrigan21:04:05

Cool. Not sending attachments, so will look at your example tomorrow 😊

dharrigan07:04:18

Works fantastic! Thank you 🙂

dharrigan15:04:50

...life is too short...

mccraigmccraig15:04:27

also my thoughts when using interop to hit the AWS java SDK 😬

👍 4
😱 4