[Haskell-cafe] Amazon SES email issues

David Escobar davidescobar at ieee.org
Wed May 4 01:29:08 UTC 2016


Hi Vlatko, just wanted to get back to you on this. It looks like we're
using EC2 instances, but after looking at the SES section, it doesn't seem
to be tied to any specific instance (not sure if and how that's different
from the E2 instances you're using).

I also used the Amazon verified email address in the system as the 'From'
address, but unfortunately, it still didn't work. The keys are correct too.
For now, I just ended up going with my Rust solution since it was such a
small utility app anyway, but it would be interesting to see if other
people run into similar issues in the future. Thanks.

On Sat, Apr 30, 2016 at 12:39 AM, Vlatko Basic <vlatko.basic at gmail.com>
wrote:

> Hi David,
>
> I'm using almost exact function as you wrote below and it works without
> problems. Using mime-mail-ses-0.3.2.2.
>
> However, it works on E2 instance. Don't know if that matters.
>
> Stupid question, but have you double checked keys?
>
> I received similar errors when keys were not correct (they were not
> hardcoded, but fetched).
>
>
> br,
>
> vlatko
>
> -------- Original Message --------
> Subject: Re: [Haskell-cafe] Amazon SES email issues
> From: David Escobar <davidescobar at ieee.org> <davidescobar at ieee.org>
> To: David Johnson <djohnson.m at gmail.com> <djohnson.m at gmail.com>
> Cc: Haskell Cafe <haskell-cafe at haskell.org> <haskell-cafe at haskell.org>
> Date: 30/04/16 09:10
>
>
> David, thanks for the suggestion. Are there any examples on how to send an
> email? I've looked through several of the Haskell email packages and have
> been able to figure out their APIs easily enough, but this one seems
> incredibly complex - almost seem to have to know the internals of SES to
> use it effectively and the documentation / examples are scant.
>
> On Fri, Apr 29, 2016 at 7:07 AM, David Johnson <djohnson.m at gmail.com>
> wrote:
>
>> I think that package is using an outdated version of the AWS Signing
>> algorithm.
>>
>> "AWS3-HTTPS"
>> I think AWS is migrating most of their APIs (who have domains / services created after a certain date) to require using the V4 Signature algorithm for all API requests.
>>
>> The amazonka-ses would probably work better.
>>
>>
>> On Fri, Apr 29, 2016 at 1:45 AM, David Escobar < <davidescobar at ieee.org>
>> davidescobar at ieee.org> wrote:
>>
>>> Hi everyone,
>>> I'm having issues with sending email through Amazon SES. I'm using the
>>> *Network.Mail.Mime.SES* package. The error I get is:
>>>
>>> *email-test-exe: SESException {seStatus = Status {statusCode = 403,
>>> statusMessage = "Forbidden"}, seCode = "SignatureDoesNotMatch", seMessage =
>>> "The request signature we calculated does not match the signature you
>>> provided. Check your AWS Secret Access Key and signing method. Consult the
>>> service documentation for details.", seRequestId =
>>> "8ceb250a-0dd3-11e6-892c-4fb1a14d4732"}*
>>>
>>> What's confusing is that I'm using the same SES settings in a Rails app
>>> as well as a small Rust console program without any issues (it works from
>>> the same machine too). The only thing I can think of is that with this
>>> Haskell package, I haven't found where to set certain things like the port
>>> number (587) and so maybe it's that? Here is a small sample app that
>>> illustrates the problem. What am I missing? Thanks.
>>>
>>>
>>>
>>> *{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}*
>>> *module Main where*
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> * import Data.Function ((&)) import GHC.Generics import
>>> Network.HTTP.Client import Network.HTTP.Client.TLS import Network.Mail.Mime
>>> import Network.Mail.Mime.SES import Text.Hamlet (shamlet) import
>>> Text.Blaze.Html.Renderer.String (renderHtml) import qualified
>>> Data.ByteString.Char8 as C8 import qualified Data.Text as T import
>>> qualified Data.Text.Lazy as LT main :: IO () main = do   manager <-
>>> newManager tlsManagerSettings   let sesConfig = SES { sesFrom = C8.pack
>>> "de at somewhere.com <de at somewhere.com>",                         sesTo = [
>>> C8.pack "someone.else at somewhereelse.com <someone.else at somewhereelse.com>"
>>> ],                         sesAccessKey = "SOMEAWSACCESSKEY",
>>>           sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890",
>>>             sesRegion = usEast1 }       email = Mail { mailFrom = Address
>>> (Just "David Escobar") " <de at somewhere.com>de at somewhere.com
>>> <de at somewhere.com>",                      mailTo = [ Address (Just "Someone
>>> Else") " <someone.else at somewhereelse.com>someone.else at somewhereelse.com
>>> <someone.else at somewhereelse.com>" ],                      mailParts = [ [
>>> htmlPart testEmail ] ],                      mailCc = [],
>>>    mailBcc = [],                      mailHeaders = [ ("subject", "Some
>>> Test Email"),                                      ("Content-Type",
>>> "text/html; charset=ISO-8859-1") ] }   renderSendMailSES manager sesConfig
>>> email testEmail :: LT.Text testEmail =   let rows = [ [ "1", "2", "3" ], [
>>> "4", "5", "6" ]]   in     renderHtml [shamlet|       $doctype 5
>>> <html>         <body>           <table style="border: 1px solid black;
>>> border-collapse: collapse; margin: 25px 0; width: 100%;">             <tr>
>>>               <th style="background-color: #072a2d; color: white;
>>> font-weight: bold; border-right: 1px solid white; padding: 5px 10px; width:
>>> 33%;">                 Column 1               <th style="background-color:
>>> #072a2d; color: white; font-weight: bold; border-right: 1px solid white;
>>> padding: 5px 10px; width: 33%;">                 Column 2               <th
>>> style="background-color: #072a2d; color: white; font-weight: bold;
>>> border-right: 1px solid white; padding: 5px 10px; width: 33%;">
>>>     Column 3             $forall row <- rows               <tr
>>> style="background-color: #f8f9ee;">                 <td style="border: 1px
>>> solid black; padding: 5px 10px; text-align: left; width: 33%;">
>>>       #{T.pack $ row !! 0}                 <td style="border: 1px solid
>>> black; padding: 5px 10px; text-align: left; width: 33%;">
>>> #{T.pack $ row !! 1}                 <td style="border: 1px solid black;
>>> padding: 5px 10px; text-align: left; width: 33%;">
>>> #{T.pack $ row !! 2}     |] & LT.pack*
>>>
>>>
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe at haskell.org
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>>
>>>
>>
>>
>> --
>> Cell: 1.630.740.8204
>>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing listHaskell-Cafe at haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160503/9ca918cf/attachment.html>


More information about the Haskell-Cafe mailing list