Amazon SES email issues

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.Genericsimport
Network.HTTP.Clientimport Network.HTTP.Client.TLSimport
Network.Mail.Mimeimport Network.Mail.Mime.SESimport Text.Hamlet
(shamlet)import Text.Blaze.Html.Renderer.String (renderHtml)import
qualified Data.ByteString.Char8 as C8import qualified Data.Text as Timport
qualified Data.Text.Lazy as LTmain :: IO ()main = do manager <- newManager
tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack
"de@somewhere.com

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
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.Genericsimport Network.HTTP.Clientimport Network.HTTP.Client.TLSimport Network.Mail.Mimeimport Network.Mail.Mime.SESimport Text.Hamlet (shamlet)import Text.Blaze.Html.Renderer.String (renderHtml)import qualified Data.ByteString.Char8 as C8import qualified Data.Text as Timport qualified Data.Text.Lazy as LTmain :: IO ()main = do manager <- newManager tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack "de@somewhere.com
", sesTo = [ C8.pack "someone.else@somewhereelse.com " ], sesAccessKey = "SOMEAWSACCESSKEY", sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", sesRegion = usEast1 } email = Mail { mailFrom = Address (Just "David Escobar") "de@somewhere.com ", mailTo = [ Address (Just "Someone Else") "someone.else@somewhereelse.com " ], mailParts = [ [ htmlPart testEmail ] ], mailCc = [], mailBcc = [], mailHeaders = [ ("subject", "Some Test Email"), ("Content-Type", "text/html; charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig emailtestEmail :: LT.TexttestEmail = 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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Cell: 1.630.740.8204

Also, make sure the time on the machine you are running this client didn't
drift too far from the server's time. If this delta crosses a threshold,
you will see similar issues.
On Fri, Apr 29, 2016 at 11:07 AM, David Johnson
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
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.Genericsimport Network.HTTP.Clientimport Network.HTTP.Client.TLSimport Network.Mail.Mimeimport Network.Mail.Mime.SESimport Text.Hamlet (shamlet)import Text.Blaze.Html.Renderer.String (renderHtml)import qualified Data.ByteString.Char8 as C8import qualified Data.Text as Timport qualified Data.Text.Lazy as LTmain :: IO ()main = do manager <- newManager tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack "de@somewhere.com
", sesTo = [ C8.pack "someone.else@somewhereelse.com " ], sesAccessKey = "SOMEAWSACCESSKEY", sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", sesRegion = usEast1 } email = Mail { mailFrom = Address (Just "David Escobar") "de@somewhere.com ", mailTo = [ Address (Just "Someone Else") "someone.else@somewhereelse.com " ], mailParts = [ [ htmlPart testEmail ] ], mailCc = [], mailBcc = [], mailHeaders = [ ("subject", "Some Test Email"), ("Content-Type", "text/html; charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig emailtestEmail :: LT.TexttestEmail = 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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Cell: 1.630.740.8204
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

Thanks Yuri. It's not the case this time, but I've run into this issue in
the past, particularly when running Linux in a VM and the VM goes to sleep
- sometimes the clock goes out of sync.
On Fri, Apr 29, 2016 at 8:20 AM, Yuri de Wit
Also, make sure the time on the machine you are running this client didn't drift too far from the server's time. If this delta crosses a threshold, you will see similar issues.
On Fri, Apr 29, 2016 at 11:07 AM, David Johnson
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
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.Genericsimport Network.HTTP.Clientimport Network.HTTP.Client.TLSimport Network.Mail.Mimeimport Network.Mail.Mime.SESimport Text.Hamlet (shamlet)import Text.Blaze.Html.Renderer.String (renderHtml)import qualified Data.ByteString.Char8 as C8import qualified Data.Text as Timport qualified Data.Text.Lazy as LTmain :: IO ()main = do manager <- newManager tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack "de@somewhere.com
", sesTo = [ C8.pack "someone.else@somewhereelse.com " ], sesAccessKey = "SOMEAWSACCESSKEY", sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", sesRegion = usEast1 } email = Mail { mailFrom = Address (Just "David Escobar") "de@somewhere.com ", mailTo = [ Address (Just "Someone Else") "someone.else@somewhereelse.com " ], mailParts = [ [ htmlPart testEmail ] ], mailCc = [], mailBcc = [], mailHeaders = [ ("subject", "Some Test Email"), ("Content-Type", "text/html; charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig emailtestEmail :: LT.TexttestEmail = 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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Cell: 1.630.740.8204
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

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
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
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.Genericsimport Network.HTTP.Clientimport Network.HTTP.Client.TLSimport Network.Mail.Mimeimport Network.Mail.Mime.SESimport Text.Hamlet (shamlet)import Text.Blaze.Html.Renderer.String (renderHtml)import qualified Data.ByteString.Char8 as C8import qualified Data.Text as Timport qualified Data.Text.Lazy as LTmain :: IO ()main = do manager <- newManager tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack "de@somewhere.com
", sesTo = [ C8.pack "someone.else@somewhereelse.com " ], sesAccessKey = "SOMEAWSACCESSKEY", sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", sesRegion = usEast1 } email = Mail { mailFrom = Address (Just "David Escobar") "de@somewhere.com ", mailTo = [ Address (Just "Someone Else") "someone.else@somewhereelse.com " ], mailParts = [ [ htmlPart testEmail ] ], mailCc = [], mailBcc = [], mailHeaders = [ ("subject", "Some Test Email"), ("Content-Type", "text/html; charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig emailtestEmail :: LT.TexttestEmail = 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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Cell: 1.630.740.8204

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
To: David Johnson Cc: Haskell Cafe 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
mailto:djohnson.m@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
mailto:davidescobar@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@somewhere.com mailto:de@somewhere.com", sesTo = [ C8.pack "someone.else@somewhereelse.com mailto:someone.else@somewhereelse.com" ], sesAccessKey = "SOMEAWSACCESSKEY", sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", sesRegion = usEast1 } email = Mail { mailFrom = Address (Just "David Escobar") "de@somewhere.com mailto:de@somewhere.com", mailTo = [ Address (Just "Someone Else") "someone.else@somewhereelse.com mailto:someone.else@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@haskell.org mailto:Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Cell: 1.630.740.8204 tel:1.630.740.8204
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

Hi Vlatko,
Yes, I've double checked the keys. I'm using the same ones in a Rails app
as well as a small Rust CLI program and they both work (on the same machine
too). So it's definitely something I'm missing on the Haskell side.
I checked my package versions, and I have:
mime-mail 0.4.11
mime-mail-ses 0.3.2.2
mime-types 0.1.0.6
So it looks like we're using the same versions. I'm not sure about the E2
instance. I'll have to check with my DevOps colleague at work to make sure.
If it's still SES email, I would imagine that it shouldn't matter,
especially since both the Ruby (ActionMailer) and Rust (lettre) email
libraries I'm using are general email libraries and not SES-specific and
they both work fine, but at this point, who knows? I've tried everything
else without success, but the fact that you're using it ok tells me I'm
probably close and just missing a small detail or so.
Kind of surprised how difficult it's been actually. I was expecting the
Rust library to be the one that gave me problems. :)
On Sat, Apr 30, 2016 at 12:39 AM, Vlatko Basic
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
To: David Johnson Cc: Haskell Cafe 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
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@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@somewhere.com
", sesTo = [ C8.pack "someone.else@somewhereelse.com " ], sesAccessKey = "SOMEAWSACCESSKEY", sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", sesRegion = usEast1 } email = Mail { mailFrom = Address (Just "David Escobar") " de@somewhere.com ", mailTo = [ Address (Just "Someone Else") " someone.else@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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Cell: 1.630.740.8204
_______________________________________________ Haskell-Cafe mailing listHaskell-Cafe@haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

Hi, Just saw a note in my code about one more thing. Actually very important. The From: email address, "*sesFrom = C8.pack "de@somewhere.com mailto:de@somewhere.com"*", has to be verified at Amazon. For "sesFrom" you can't use any email address, but can in "mailFrom". Since your Ruby and Rust code are not SES-specific, maybe you can try a more general library, like Network.HaskellNet.SMTP. I'm using it for local SMTP, but haven't tried it with SES. If you'll try it and have success, let us know. br, vlatko
-------- Original Message -------- Subject: Re: [Haskell-cafe] Amazon SES email issues From: David Escobar
To: vlatko.basic@gmail.com, Haskell Cafe Date: 30/04/16 10:31 Hi Vlatko, Yes, I've double checked the keys. I'm using the same ones in a Rails app as well as a small Rust CLI program and they both work (on the same machine too). So it's definitely something I'm missing on the Haskell side.
I checked my package versions, and I have: mime-mail 0.4.11 mime-mail-ses 0.3.2.2 mime-types 0.1.0.6
So it looks like we're using the same versions. I'm not sure about the E2 instance. I'll have to check with my DevOps colleague at work to make sure. If it's still SES email, I would imagine that it shouldn't matter, especially since both the Ruby (ActionMailer) and Rust (lettre) email libraries I'm using are general email libraries and not SES-specific and they both work fine, but at this point, who knows? I've tried everything else without success, but the fact that you're using it ok tells me I'm probably close and just missing a small detail or so.
Kind of surprised how difficult it's been actually. I was expecting the Rust library to be the one that gave me problems. :)
On Sat, Apr 30, 2016 at 12:39 AM, Vlatko Basic
mailto:vlatko.basic@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
mailto:davidescobar@ieee.org To: David Johnson mailto:djohnson.m@gmail.com Cc: Haskell Cafe mailto:haskell-cafe@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
mailto:djohnson.m@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
mailto:davidescobar@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@somewhere.com mailto:de@somewhere.com", sesTo = [ C8.pack "someone.else@somewhereelse.com mailto:someone.else@somewhereelse.com" ], sesAccessKey = "SOMEAWSACCESSKEY", sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", sesRegion = usEast1 } email = Mail { mailFrom = Address (Just "David Escobar") "de@somewhere.com mailto:de@somewhere.com", mailTo = [ Address (Just "Someone Else") "someone.else@somewhereelse.com mailto:someone.else@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@haskell.org mailto:Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Cell: 1.630.740.8204 tel:1.630.740.8204
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org mailto:Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

Hi Imants. I thought about using a library in another language (since I
know they work), but since I'm just writing a very small utility program,
if I use another language for the email portion, I may as well write the
whole utility in that language (which I actually did end up doing - in
Rust).
On Sat, Apr 30, 2016 at 1:54 AM, Imants Cekusins
are Amazon client API libraries (java, ...) - an option?
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

Yes, there's another thread from last week, where I was using
Network.HaskellNet.SMTP (and Network.HaskellNet.SMTP.SSL). It worked great
when using a Gmail account, and I was also able to send emails using SES,
however, with the SES version, it mangled the HTML and CSS in weird ways by
inserting line breaks and carriage returns in odd places, which basically
destroyed the formatting of the email. I'd never seen that happen before
with other libraries. That's when someone suggested I look at
Network.Mime.Mail.SES.
But yeah, the verified email address might be the issue. I'll check with
DevOps on that as well. Thanks!
On Sat, Apr 30, 2016 at 1:48 AM, Vlatko Basic
Hi,
Just saw a note in my code about one more thing. Actually very important.
The From: email address, "*sesFrom = C8.pack "de@somewhere.com
"*", has to be verified at Amazon. For "sesFrom" you can't use any email address, but can in "mailFrom".
Since your Ruby and Rust code are not SES-specific, maybe you can try a more general library, like Network.HaskellNet.SMTP.
I'm using it for local SMTP, but haven't tried it with SES.
If you'll try it and have success, let us know.
br,
vlatko
-------- Original Message -------- Subject: Re: [Haskell-cafe] Amazon SES email issues From: David Escobar
To: vlatko.basic@gmail.com, Haskell Cafe Date: 30/04/16 10:31 Hi Vlatko, Yes, I've double checked the keys. I'm using the same ones in a Rails app as well as a small Rust CLI program and they both work (on the same machine too). So it's definitely something I'm missing on the Haskell side.
I checked my package versions, and I have: mime-mail 0.4.11 mime-mail-ses 0.3.2.2 mime-types 0.1.0.6
So it looks like we're using the same versions. I'm not sure about the E2 instance. I'll have to check with my DevOps colleague at work to make sure. If it's still SES email, I would imagine that it shouldn't matter, especially since both the Ruby (ActionMailer) and Rust (lettre) email libraries I'm using are general email libraries and not SES-specific and they both work fine, but at this point, who knows? I've tried everything else without success, but the fact that you're using it ok tells me I'm probably close and just missing a small detail or so.
Kind of surprised how difficult it's been actually. I was expecting the Rust library to be the one that gave me problems. :)
On Sat, Apr 30, 2016 at 12:39 AM, Vlatko Basic
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
To: David Johnson Cc: Haskell Cafe 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@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@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@somewhere.com ", sesTo = [ C8.pack " someone.else@somewhereelse.com " ], sesAccessKey = "SOMEAWSACCESSKEY", sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", sesRegion = usEast1 } email = Mail { mailFrom = Address (Just "David Escobar") " de@somewhere.com ", mailTo = [ Address (Just "Someone Else") " someone.else@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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Cell: 1.630.740.8204
_______________________________________________ Haskell-Cafe mailing listHaskell-Cafe@haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

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
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
To: David Johnson Cc: Haskell Cafe 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
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@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@somewhere.com
", sesTo = [ C8.pack "someone.else@somewhereelse.com " ], sesAccessKey = "SOMEAWSACCESSKEY", sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", sesRegion = usEast1 } email = Mail { mailFrom = Address (Just "David Escobar") " de@somewhere.com ", mailTo = [ Address (Just "Someone Else") " someone.else@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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Cell: 1.630.740.8204
_______________________________________________ Haskell-Cafe mailing listHaskell-Cafe@haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

No examples for amazonka-ses yet unfortunately. There are brief examples in
the source repository for other services:
https://github.com/brendanhay/amazonka/tree/develop/examples/src/Example
I'll add something for SES shortly.
The amazonka-* library operations and types map directly to the AWS
documentation - so you will need to a) have an understanding of the
product/service offering b) be willing to reference the relevant AWS
documentation.
Each amazonka-* library can be considered a 'low level' interface to the
related Amazon service, with a unified AuthN/AuthZ (newEnv) and
request/response (send) interface available in the main 'amazonka' library.
For your example above, as the older AWS APIs tend to have fairly unhelpful
error messages - your only option unfortunately is trial and error. The
keys are naturally the first thing to check, make sure you haven't mixed up
the access and secret keys by accident and that they are in fact the same
keys being used by your equivalent Rust program.
Just for clarification - you mentioned port 587, are you attempting to
communicate with a non-standard endpoint?
On 30 April 2016 at 09:10, David Escobar
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
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
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.Genericsimport Network.HTTP.Clientimport Network.HTTP.Client.TLSimport Network.Mail.Mimeimport Network.Mail.Mime.SESimport Text.Hamlet (shamlet)import Text.Blaze.Html.Renderer.String (renderHtml)import qualified Data.ByteString.Char8 as C8import qualified Data.Text as Timport qualified Data.Text.Lazy as LTmain :: IO ()main = do manager <- newManager tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack "de@somewhere.com
", sesTo = [ C8.pack "someone.else@somewhereelse.com " ], sesAccessKey = "SOMEAWSACCESSKEY", sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", sesRegion = usEast1 } email = Mail { mailFrom = Address (Just "David Escobar") "de@somewhere.com ", mailTo = [ Address (Just "Someone Else") "someone.else@somewhereelse.com " ], mailParts = [ [ htmlPart testEmail ] ], mailCc = [], mailBcc = [], mailHeaders = [ ("subject", "Some Test Email"), ("Content-Type", "text/html; charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig emailtestEmail :: LT.TexttestEmail = 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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Cell: 1.630.740.8204
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

Hi Brendan. Yes, I use port 587 in my other apps and it's worked fine
there. When using Network.Mail.Mime.SES, I haven't found a place to
explicitly set it though. Perhaps it assumes 587 by default? I've also used
the same keys but no success there. I tried flipping them around, and got
an authentication error, so I know the original order was correct.
The only other thing I'm doing in my Rust program is setting the
authentication mechanism to PLAIN and there's also an option to always
encrypt which I've set as well. There doesn't seem to be an exact
equivalent set of options in Network.Mail.Mime.SES, but perhaps it also
does those by default?
On Sat, Apr 30, 2016 at 12:59 AM, Brendan Hay
No examples for amazonka-ses yet unfortunately. There are brief examples in the source repository for other services: https://github.com/brendanhay/amazonka/tree/develop/examples/src/Example I'll add something for SES shortly.
The amazonka-* library operations and types map directly to the AWS documentation - so you will need to a) have an understanding of the product/service offering b) be willing to reference the relevant AWS documentation. Each amazonka-* library can be considered a 'low level' interface to the related Amazon service, with a unified AuthN/AuthZ (newEnv) and request/response (send) interface available in the main 'amazonka' library.
For your example above, as the older AWS APIs tend to have fairly unhelpful error messages - your only option unfortunately is trial and error. The keys are naturally the first thing to check, make sure you haven't mixed up the access and secret keys by accident and that they are in fact the same keys being used by your equivalent Rust program.
Just for clarification - you mentioned port 587, are you attempting to communicate with a non-standard endpoint?
On 30 April 2016 at 09:10, David Escobar
wrote: 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
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
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.Genericsimport Network.HTTP.Clientimport Network.HTTP.Client.TLSimport Network.Mail.Mimeimport Network.Mail.Mime.SESimport Text.Hamlet (shamlet)import Text.Blaze.Html.Renderer.String (renderHtml)import qualified Data.ByteString.Char8 as C8import qualified Data.Text as Timport qualified Data.Text.Lazy as LTmain :: IO ()main = do manager <- newManager tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack "de@somewhere.com
", sesTo = [ C8.pack "someone.else@somewhereelse.com " ], sesAccessKey = "SOMEAWSACCESSKEY", sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", sesRegion = usEast1 } email = Mail { mailFrom = Address (Just "David Escobar") "de@somewhere.com ", mailTo = [ Address (Just "Someone Else") "someone.else@somewhereelse.com " ], mailParts = [ [ htmlPart testEmail ] ], mailCc = [], mailBcc = [], mailHeaders = [ ("subject", "Some Test Email"), ("Content-Type", "text/html; charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig emailtestEmail :: LT.TexttestEmail = 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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Cell: 1.630.740.8204
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
participants (6)
-
Brendan Hay
-
David Escobar
-
David Johnson
-
Imants Cekusins
-
Vlatko Basic
-
Yuri de Wit