<div dir="ltr">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.<div><br></div><div>But yeah, the verified email address might be the issue. I'll check with DevOps on that as well. Thanks!</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 30, 2016 at 1:48 AM, Vlatko Basic <span dir="ltr"><<a href="mailto:vlatko.basic@gmail.com" target="_blank">vlatko.basic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="background-color:rgb(255,255,255);color:rgb(0,0,0)" text="#000000" bgcolor="#FFFFFF">
Hi,<br>
<br>
Just saw a note in my code about one more thing. Actually very
important.<br>
<p>The From: email address, "<font face="monospace, monospace"><b>sesFrom
= C8.pack "<a href="mailto:de@somewhere.com" target="_blank">de@somewhere.com</a>"</b></font>",
has to be verified at Amazon.</p>
<p>For "sesFrom" you can't use any email address, but can in
"mailFrom".<br>
</p>
<p><br>
</p>
<p>Since your Ruby and Rust code are not SES-specific, maybe you can
try a more general library, like Network.HaskellNet.SMTP.</p>
<p>I'm using it for local SMTP, but haven't tried it with SES.</p>
<p>If you'll try it and have success, let us know.<br>
</p>
<p><br>
</p>
<p>br,</p>
<p>vlatko<br>
</p>
<p><br>
</p>
<blockquote style="border-left:2px solid #330033!important;border-right:2px solid #330033!important;padding:0px 15px 0px 15px;margin:8px 2px" type="cite"><span style="color:#000000">
<div><span class="">-------- Original Message --------<br>
Subject: Re: [Haskell-cafe] Amazon SES email issues<br>
From: David Escobar <a href="mailto:davidescobar@ieee.org" target="_blank"><davidescobar@ieee.org></a><br></span><div><div class="h5">
To: <a href="mailto:vlatko.basic@gmail.com" target="_blank">vlatko.basic@gmail.com</a>, Haskell Cafe
<a href="mailto:haskell-cafe@haskell.org" target="_blank"><haskell-cafe@haskell.org></a><br>
Date: 30/04/16 10:31<br>
</div></div></div>
<br>
<br>
</span><div><div class="h5">
<div dir="ltr">Hi Vlatko,
<div>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.</div>
<div><br>
</div>
<div>I checked my package versions, and I have:</div>
<div>mime-mail 0.4.11<br>
</div>
<div>mime-mail-ses 0.3.2.2</div>
<div>mime-types 0.1.0.6</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Kind of surprised how difficult it's been actually. I was
expecting the Rust library to be the one that gave me
problems. :)</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sat, Apr 30, 2016 at 12:39 AM,
Vlatko Basic <span dir="ltr"><<a href="mailto:vlatko.basic@gmail.com" target="_blank">vlatko.basic@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="background-color:rgb(255,255,255);color:rgb(0,0,0)" text="#000000" bgcolor="#FFFFFF"> Hi David,<br>
<br>
I'm using almost exact function as you wrote below and it
works without problems. Using mime-mail-ses-0.3.2.2.<br>
<p>However, it works on E2 instance. Don't know if that
matters.</p>
<p>Stupid question, but have you double checked keys? <br>
</p>
<p>I received similar errors when keys were not correct
(they were not hardcoded, but fetched).</p>
<p><br>
</p>
<p>br,</p>
<p>vlatko<br>
</p>
<div>
<div> <br>
<blockquote style="border-left:2px solid #330033!important;border-right:2px solid #330033!important;padding:0px 15px 0px 15px;margin:8px 2px" type="cite"><span style="color:#000000">
<div>-------- Original Message --------<br>
Subject: Re: [Haskell-cafe] Amazon SES email
issues<br>
From: David Escobar <a href="mailto:davidescobar@ieee.org" target="_blank"><davidescobar@ieee.org></a><br>
To: David Johnson <a href="mailto:djohnson.m@gmail.com" target="_blank"><djohnson.m@gmail.com></a><br>
Cc: Haskell Cafe <a href="mailto:haskell-cafe@haskell.org" target="_blank"><haskell-cafe@haskell.org></a><br>
Date: 30/04/16 09:10<br>
</div>
<br>
<br>
</span>
<div dir="ltr">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.</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Apr 29, 2016 at
7:07 AM, David Johnson <span dir="ltr"><<a href="mailto:djohnson.m@gmail.com" target="_blank"></a><a href="mailto:djohnson.m@gmail.com" target="_blank">djohnson.m@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I think that package is using
an outdated version of the AWS Signing
algorithm.<br>
<pre><span><font color="#008080">"AWS3-HTTPS"
</font><font face="arial, sans-serif"><span style="white-space:normal">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.</span></font></span></pre>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">
<div>
<div>On Fri, Apr 29, 2016 at 1:45 AM,
David Escobar <span dir="ltr"><<a href="mailto:davidescobar@ieee.org" target="_blank"></a><a href="mailto:davidescobar@ieee.org" target="_blank">davidescobar@ieee.org</a>></span>
wrote:<br>
</div>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>
<div dir="ltr">Hi everyone,
<div>I'm having issues with
sending email through Amazon
SES. I'm using the <b>Network.Mail.Mime.SES</b>
package. The error I get is:</div>
<div><br>
</div>
<div><b>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"}</b></div>
<div>
<p>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.</p>
<p><br>
<font face="monospace,
monospace"><b>{-# LANGUAGE
OverloadedStrings #-}<br>
{-# LANGUAGE QuasiQuotes
#-}</b></font></p>
<font face="monospace,
monospace"><b>module Main
where</b></font></div>
<div><font face="monospace,
monospace"><b><br>
import Data.Function
((&))<br>
import GHC.Generics<br>
import Network.HTTP.Client<br>
import
Network.HTTP.Client.TLS<br>
import Network.Mail.Mime<br>
import Network.Mail.Mime.SES<br>
import Text.Hamlet (shamlet)<br>
import
Text.Blaze.Html.Renderer.String
(renderHtml)<br>
<br>
import qualified
Data.ByteString.Char8 as C8<br>
import qualified Data.Text
as T<br>
import qualified
Data.Text.Lazy as LT<br>
<br>
main :: IO ()<br>
main = do<br>
manager <- newManager
tlsManagerSettings<br>
let sesConfig = SES {
sesFrom = C8.pack "<a href="mailto:de@somewhere.com" target="_blank"></a><a href="mailto:de@somewhere.com" target="_blank">de@somewhere.com</a>",<br>
sesTo = [ C8.pack "<a href="mailto:someone.else@somewhereelse.com" target="_blank"></a><a href="mailto:someone.else@somewhereelse.com" target="_blank">someone.else@somewhereelse.com</a>"
],<br>
sesAccessKey =
"SOMEAWSACCESSKEY",<br>
sesSecretKey =
"ANEVENLONGERAWSSECRETKEY1234567890",<br>
sesRegion = usEast1 }<br>
email = Mail {
mailFrom = Address (Just
"David Escobar") "<a href="mailto:de@somewhere.com" target="_blank"></a><a href="mailto:de@somewhere.com" target="_blank">de@somewhere.com</a>",<br>
mailTo
= [ Address (Just "Someone
Else") "<a href="mailto:someone.else@somewhereelse.com" target="_blank"></a><a href="mailto:someone.else@somewhereelse.com" target="_blank">someone.else@somewhereelse.com</a>"
],<br>
mailParts = [ [ htmlPart
testEmail ] ],<br>
mailCc
= [],<br>
mailBcc
= [],<br>
mailHeaders = [ ("subject",
"Some Test Email"),<br>
("Content-Type",
"text/html;
charset=ISO-8859-1") ] }<br>
renderSendMailSES manager
sesConfig email<br>
<br>
<br>
testEmail :: LT.Text<br>
testEmail =<br>
let rows = [ [ "1", "2",
"3" ], [ "4", "5", "6" ]]<br>
in<br>
renderHtml [shamlet|<br>
$doctype 5<br>
<html><br>
<body><br>
<table
style="border: 1px solid
black; border-collapse:
collapse; margin: 25px 0;
width: 100%;"><br>
<tr><br>
<th
style="background-color:
#072a2d; color: white;
font-weight: bold;
border-right: 1px solid
white; padding: 5px 10px;
width: 33%;"><br>
Column 1<br>
<th
style="background-color:
#072a2d; color: white;
font-weight: bold;
border-right: 1px solid
white; padding: 5px 10px;
width: 33%;"><br>
Column 2<br>
<th
style="background-color:
#072a2d; color: white;
font-weight: bold;
border-right: 1px solid
white; padding: 5px 10px;
width: 33%;"><br>
Column 3<br>
$forall row
<- rows<br>
<tr
style="background-color:
#f8f9ee;"><br>
<td
style="border: 1px solid
black; padding: 5px 10px;
text-align: left; width:
33%;"><br>
#{T.pack $
row !! 0}<br>
<td
style="border: 1px solid
black; padding: 5px 10px;
text-align: left; width:
33%;"><br>
#{T.pack $
row !! 1}<br>
<td
style="border: 1px solid
black; padding: 5px 10px;
text-align: left; width:
33%;"><br>
#{T.pack $
row !! 2}<br>
|] & LT.pack</b></font></div>
<div><br>
</div>
</div>
<br>
</div>
</div>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br>
</blockquote>
</div>
<span><font color="#888888"><br>
<br clear="all">
<div><br>
</div>
-- <br>
<div>Cell: <a href="tel:1.630.740.8204" value="+16307408204" target="_blank">1.630.740.8204</a></div>
</font></span></div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
Haskell-Cafe mailing list
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div></div></blockquote>
<br>
</div>
</blockquote></div><br></div>