Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

fix(ses): allow SendRawEmail without Source when MIME From is present (#800)

Kenshin Okinaka15db990b39bb
diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesService.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesService.java
index b78d22b7de..ecca5bcda6 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ses/SesService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesService.java
@@ -183,9 +183,6 @@ public class SesService {
}
public String sendRawEmail(String source, List<String> destinations, String rawMessage, String region) {
- if (source == null || source.isBlank()) {
- throw new AwsException("InvalidParameterValue", "Source email is required.", 400);
- }
if (rawMessage == null || rawMessage.isBlank()) {
throw new AwsException("InvalidParameterValue", "RawMessage.Data is required.", 400);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java
index ee4dc1e909..d653dbfe7e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java
@@ -200,6 +200,26 @@ class SesIntegrationTest {
.body(containsString("<MessageId>"));
}
+ @Test
+ @Order(29)
+ void sendRawEmail_withoutSource_acceptedWhenMimeFromPresent() {
+ // Regression for https://github.com/floci-io/floci/issues/797
+ // AWS SES SendRawEmail allows omitting the Source parameter when the
+ // raw MIME message contains a From: header.
+ given()
+ .contentType("application/x-www-form-urlencoded")
+ .header("Authorization", "AWS4-HMAC-SHA256 Credential=AKID/20260101/us-east-1/email/aws4_request")
+ .formParam("Action", "SendRawEmail")
+ .formParam("Destinations.member.1", "[email protected]")
+ .formParam("RawMessage.Data",
+ "From: [email protected]\r\nTo: [email protected]\r\nSubject: hello\r\n\r\nbody\r\n")
+ .when()
+ .post("/")
+ .then()
+ .statusCode(200)
+ .body(containsString("<MessageId>"));
+ }
+
@Test
@Order(12)
void getSendQuota() {