aristidb/aws — pull request #73 by abhinav (2013-05-28 07:08:42+00:00)
Title: Incorrect parameters for SES `SendRawEmail`

SES `SendRawEmail` requests are being sent with incorrect parameters for the `Destinations` parameter. Currently, the module uses the format for the [`Destination` object](http://docs.aws.amazon.com/ses/latest/APIReference/API_Destination.html) but the `SendRawEmail` command expects a list of email addresses ([documented here](http://docs.aws.amazon.com/ses/latest/APIReference/API_SendRawEmail.html)) or, if that's not given, at least a `To` header in the raw message.

If I try to send an email without a `To` header right now, SES will throw an error because it doesn't have any destination to send the mail to (the `Destination` object parameters are ignored).

λ> [...] $ Ses.SendRawEmail (Just (Ses.Destination [] [] ["recipient@example.com"])) rawMessage sender
*** Exception: SesError {sesStatusCode = Status {statusCode = 400, statusMessage = "Bad Request"}, sesErrorCode = "InvalidParameterValue", sesErrorMessage = "Missing required header 'To'."}

This commit changes `SendRawEmail` to accept a list of destination email addresses and corrects the parameters sent to that command.

λ> [...] $ Ses.SendRawEmail ["recipient@example.com"] rawMessage sender
SendRawEmailResponse {srmrMessageId = "[...]"}

It still works if the list of recipients is empty and `To` headers are given.