mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 14:30:28 -05:00
feat(ses): add SendBulkEmail (v2) and SendBulkTemplatedEmail (v1) (#645)
* feat(ses): add SendBulkEmail (v2) and SendBulkTemplatedEmail (v1) Adds bulk templated email support for both the SES v1 Query API (SendBulkTemplatedEmail) and the SES v2 REST JSON API (POST /v2/email/outbound-bulk-emails). The two endpoints share a single SesService.sendBulkTemplatedEmail method that resolves the template upfront, merges DefaultTemplateData with each entry's ReplacementTemplateData at the JSON-key level (replacement wins), renders subject/text/html via the existing applyTemplateData helper, and reuses sendEmail per destination so each successful entry appears in the existing /_aws/ses inspection mailbox with a unique MessageId. Per-entry results are returned in the BulkEmailEntryResult shape with status mapped to the AWS wire format expected by each protocol (CamelCase for v1, SCREAMING_SNAKE for v2). Per-entry AwsException codes are mapped to the closest BulkEmailEntryResult.Status (e.g. InvalidParameterValue -> INVALID_PARAMETER, which renders as "InvalidParameterValue" on v1), falling back to FAILED for unexpected exceptions. Template lookup failures and account-sending-paused conditions are top-level errors on both protocols, with v1 raising AccountSendingPausedException to match AWS semantics. * fix(ses): enforce account sending check in v1 SendEmail/SendRawEmail/SendTemplatedEmail v1 Query SES handlers previously sent mail even when account-level sending was disabled, while v2 REST JSON handlers and the new SendBulkTemplatedEmail correctly return AccountSendingPausedException. Add the same guard at the top of handleSendEmail, handleSendRawEmail, and handleSendTemplatedEmail to align v1 with v2 and AWS semantics.
This commit is contained in:
1 parent
cb0a82b749
commit
44eb8d2379
13 files changed
+1233
-1
No files matched your search
@@ -279,7 +279,7 @@ public class AwsQueryController {
|
||||
"SetIdentityNotificationTopic", "GetIdentityNotificationAttributes",
|
||||
"GetIdentityDkimAttributes",
|
||||
"CreateTemplate", "UpdateTemplate", "GetTemplate", "DeleteTemplate",
|
||||
"ListTemplates", "SendTemplatedEmail",
|
||||
"ListTemplates", "SendTemplatedEmail", "SendBulkTemplatedEmail",
|
||||
"CreateConfigurationSet", "DescribeConfigurationSet",
|
||||
"ListConfigurationSets", "DeleteConfigurationSet"
|
||||
);
|
||||
|
||||
@@ -2,6 +2,8 @@ package io.github.hectorvent.floci.services.ses;
|
||||
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.common.RegionResolver;
|
||||
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntry;
|
||||
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntryResult;
|
||||
import io.github.hectorvent.floci.services.ses.model.ConfigurationSet;
|
||||
import io.github.hectorvent.floci.services.ses.model.EmailTemplate;
|
||||
import io.github.hectorvent.floci.services.ses.model.Identity;
|
||||
@@ -278,6 +280,112 @@ public class SesController {
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/outbound-bulk-emails")
|
||||
public Response sendBulkEmail(@Context HttpHeaders headers, String body) {
|
||||
String region = regionResolver.resolveRegion(headers);
|
||||
try {
|
||||
if (!sesService.isAccountSendingEnabled(region)) {
|
||||
throw new AwsException("SendingPausedException",
|
||||
"Account sending is disabled.", 400);
|
||||
}
|
||||
|
||||
JsonNode request = objectMapper.readTree(body);
|
||||
String fromEmailAddress = request.path("FromEmailAddress").asText(null);
|
||||
if (fromEmailAddress == null || fromEmailAddress.isBlank()) {
|
||||
throw new AwsException("BadRequestException",
|
||||
"FromEmailAddress is required.", 400);
|
||||
}
|
||||
List<String> replyToAddresses = jsonArrayToList(request.path("ReplyToAddresses"));
|
||||
|
||||
JsonNode template = request.path("DefaultContent").path("Template");
|
||||
if (template.isMissingNode() || template.isNull()) {
|
||||
throw new AwsException("BadRequestException",
|
||||
"DefaultContent.Template is required.", 400);
|
||||
}
|
||||
String templateName = template.path("TemplateName").asText(null);
|
||||
String templateArn = template.path("TemplateArn").asText(null);
|
||||
boolean hasName = templateName != null && !templateName.isBlank();
|
||||
boolean hasArn = templateArn != null && !templateArn.isBlank();
|
||||
boolean hasInline = template.has("TemplateContent");
|
||||
int selectorCount = (hasName ? 1 : 0) + (hasArn ? 1 : 0) + (hasInline ? 1 : 0);
|
||||
if (selectorCount > 1) {
|
||||
throw new AwsException("BadRequestException",
|
||||
"DefaultContent.Template must specify exactly one of TemplateName, TemplateArn, or TemplateContent.",
|
||||
400);
|
||||
}
|
||||
if (selectorCount == 0) {
|
||||
throw new AwsException("BadRequestException",
|
||||
"DefaultContent.Template requires TemplateName, TemplateArn, or TemplateContent.", 400);
|
||||
}
|
||||
|
||||
String subject;
|
||||
String text;
|
||||
String html;
|
||||
if (hasInline) {
|
||||
JsonNode inline = template.path("TemplateContent");
|
||||
subject = inline.path("Subject").asText(null);
|
||||
text = inline.path("Text").asText(null);
|
||||
html = inline.path("Html").asText(null);
|
||||
} else {
|
||||
String resolvedName = hasName
|
||||
? templateName
|
||||
: SesService.templateNameFromArn(templateArn);
|
||||
EmailTemplate stored = sesService.getTemplate(resolvedName, region);
|
||||
subject = stored.getSubject();
|
||||
text = stored.getTextPart();
|
||||
html = stored.getHtmlPart();
|
||||
}
|
||||
|
||||
JsonNode defaultTemplateData = parseTemplateData(template.path("TemplateData").asText(""));
|
||||
|
||||
JsonNode bulkEntries = request.path("BulkEmailEntries");
|
||||
if (!bulkEntries.isArray() || bulkEntries.isEmpty()) {
|
||||
throw new AwsException("BadRequestException",
|
||||
"BulkEmailEntries must be a non-empty array.", 400);
|
||||
}
|
||||
|
||||
List<BulkEmailEntry> entries = new ArrayList<>();
|
||||
for (JsonNode node : bulkEntries) {
|
||||
JsonNode dest = node.path("Destination");
|
||||
List<String> to = jsonArrayToList(dest.path("ToAddresses"));
|
||||
List<String> cc = jsonArrayToList(dest.path("CcAddresses"));
|
||||
List<String> bcc = jsonArrayToList(dest.path("BccAddresses"));
|
||||
String replacementRaw = node.path("ReplacementEmailContent")
|
||||
.path("ReplacementTemplate")
|
||||
.path("ReplacementTemplateData")
|
||||
.asText("");
|
||||
entries.add(new BulkEmailEntry(to, cc, bcc, parseTemplateData(replacementRaw)));
|
||||
}
|
||||
|
||||
List<BulkEmailEntryResult> results = sesService.sendBulkTemplatedEmail(fromEmailAddress,
|
||||
replyToAddresses, subject, text, html,
|
||||
defaultTemplateData, entries, region);
|
||||
|
||||
ObjectNode response = objectMapper.createObjectNode();
|
||||
ArrayNode arr = response.putArray("BulkEmailEntryResults");
|
||||
for (BulkEmailEntryResult r : results) {
|
||||
ObjectNode item = objectMapper.createObjectNode();
|
||||
item.put("Status", r.getStatus().name());
|
||||
if (r.getMessageId() != null) {
|
||||
item.put("MessageId", r.getMessageId());
|
||||
}
|
||||
if (r.getError() != null) {
|
||||
item.put("Error", r.getError());
|
||||
}
|
||||
arr.add(item);
|
||||
}
|
||||
|
||||
LOG.infov("SES V2 SendBulkEmail: from={0}, entries={1}",
|
||||
fromEmailAddress, entries.size());
|
||||
return Response.ok(response).build();
|
||||
} catch (AwsException e) {
|
||||
throw remapV1Exception(e);
|
||||
} catch (Exception e) {
|
||||
throw new AwsException("BadRequestException", e.getMessage(), 400);
|
||||
}
|
||||
}
|
||||
|
||||
// ──────────────────────────── Templates ────────────────────────────
|
||||
|
||||
@POST
|
||||
|
||||
@@ -4,6 +4,8 @@ import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.common.AwsNamespaces;
|
||||
import io.github.hectorvent.floci.core.common.AwsQueryResponse;
|
||||
import io.github.hectorvent.floci.core.common.XmlBuilder;
|
||||
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntry;
|
||||
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntryResult;
|
||||
import io.github.hectorvent.floci.services.ses.model.ConfigurationSet;
|
||||
import io.github.hectorvent.floci.services.ses.model.EmailTemplate;
|
||||
import io.github.hectorvent.floci.services.ses.model.Identity;
|
||||
@@ -63,6 +65,7 @@ public class SesQueryHandler {
|
||||
case "DeleteTemplate" -> handleDeleteTemplate(params, region);
|
||||
case "ListTemplates" -> handleListTemplates(region);
|
||||
case "SendTemplatedEmail" -> handleSendTemplatedEmail(params, region);
|
||||
case "SendBulkTemplatedEmail" -> handleSendBulkTemplatedEmail(params, region);
|
||||
case "CreateConfigurationSet" -> handleCreateConfigurationSet(params, region);
|
||||
case "DescribeConfigurationSet" -> handleDescribeConfigurationSet(params, region);
|
||||
case "ListConfigurationSets" -> handleListConfigurationSets(region);
|
||||
@@ -137,6 +140,10 @@ public class SesQueryHandler {
|
||||
}
|
||||
|
||||
private Response handleSendEmail(MultivaluedMap<String, String> params, String region) {
|
||||
if (!sesService.isAccountSendingEnabled(region)) {
|
||||
throw new AwsException("AccountSendingPausedException",
|
||||
"Account sending is disabled.", 400);
|
||||
}
|
||||
String source = getParam(params, "Source");
|
||||
List<String> toAddresses = extractMembers(params, "Destination.ToAddresses");
|
||||
List<String> ccAddresses = extractMembers(params, "Destination.CcAddresses");
|
||||
@@ -154,6 +161,10 @@ public class SesQueryHandler {
|
||||
}
|
||||
|
||||
private Response handleSendRawEmail(MultivaluedMap<String, String> params, String region) {
|
||||
if (!sesService.isAccountSendingEnabled(region)) {
|
||||
throw new AwsException("AccountSendingPausedException",
|
||||
"Account sending is disabled.", 400);
|
||||
}
|
||||
String source = getParam(params, "Source");
|
||||
List<String> destinations = extractMembers(params, "Destinations");
|
||||
String rawMessage = getParam(params, "RawMessage.Data");
|
||||
@@ -316,6 +327,10 @@ public class SesQueryHandler {
|
||||
}
|
||||
|
||||
private Response handleSendTemplatedEmail(MultivaluedMap<String, String> params, String region) {
|
||||
if (!sesService.isAccountSendingEnabled(region)) {
|
||||
throw new AwsException("AccountSendingPausedException",
|
||||
"Account sending is disabled.", 400);
|
||||
}
|
||||
String source = getParam(params, "Source");
|
||||
List<String> toAddresses = extractMembers(params, "Destination.ToAddresses");
|
||||
List<String> ccAddresses = extractMembers(params, "Destination.CcAddresses");
|
||||
@@ -341,6 +356,63 @@ public class SesQueryHandler {
|
||||
return Response.ok(AwsQueryResponse.envelope("SendTemplatedEmail", AwsNamespaces.SES, result)).build();
|
||||
}
|
||||
|
||||
private Response handleSendBulkTemplatedEmail(MultivaluedMap<String, String> params, String region) {
|
||||
if (!sesService.isAccountSendingEnabled(region)) {
|
||||
throw new AwsException("AccountSendingPausedException",
|
||||
"Account sending is disabled.", 400);
|
||||
}
|
||||
String source = getParam(params, "Source");
|
||||
List<String> replyToAddresses = extractMembers(params, "ReplyToAddresses");
|
||||
String templateName = getParam(params, "Template");
|
||||
String templateArn = getParam(params, "TemplateArn");
|
||||
String defaultDataRaw = getParam(params, "DefaultTemplateData");
|
||||
|
||||
boolean hasName = templateName != null && !templateName.isBlank();
|
||||
boolean hasArn = templateArn != null && !templateArn.isBlank();
|
||||
if (!hasName && !hasArn) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"Template or TemplateArn is required.", 400);
|
||||
}
|
||||
String resolvedName = hasName ? templateName : SesService.templateNameFromArn(templateArn);
|
||||
EmailTemplate template = sesService.getTemplate(resolvedName, region);
|
||||
JsonNode defaultTemplateData = parseTemplateData(defaultDataRaw);
|
||||
|
||||
List<BulkEmailEntry> entries = new ArrayList<>();
|
||||
for (int i = 1; ; i++) {
|
||||
String destPrefix = "Destinations.member." + i;
|
||||
List<String> to = extractMembers(params, destPrefix + ".Destination.ToAddresses");
|
||||
List<String> cc = extractMembers(params, destPrefix + ".Destination.CcAddresses");
|
||||
List<String> bcc = extractMembers(params, destPrefix + ".Destination.BccAddresses");
|
||||
String replacementRaw = getParam(params, destPrefix + ".ReplacementTemplateData");
|
||||
if (to.isEmpty() && cc.isEmpty() && bcc.isEmpty() && replacementRaw == null) {
|
||||
break;
|
||||
}
|
||||
entries.add(new BulkEmailEntry(to, cc, bcc, parseTemplateData(replacementRaw)));
|
||||
}
|
||||
if (entries.isEmpty()) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"At least one destination is required.", 400);
|
||||
}
|
||||
|
||||
List<BulkEmailEntryResult> results = sesService.sendBulkTemplatedEmail(source, replyToAddresses,
|
||||
template.getSubject(), template.getTextPart(), template.getHtmlPart(),
|
||||
defaultTemplateData, entries, region);
|
||||
|
||||
XmlBuilder xml = new XmlBuilder().start("Status");
|
||||
for (BulkEmailEntryResult result : results) {
|
||||
xml.start("member").elem("Status", result.getStatus().toV1String());
|
||||
if (result.getMessageId() != null) {
|
||||
xml.elem("MessageId", result.getMessageId());
|
||||
}
|
||||
if (result.getError() != null) {
|
||||
xml.elem("Error", result.getError());
|
||||
}
|
||||
xml.end("member");
|
||||
}
|
||||
xml.end("Status");
|
||||
return Response.ok(AwsQueryResponse.envelope("SendBulkTemplatedEmail", AwsNamespaces.SES, xml.build())).build();
|
||||
}
|
||||
|
||||
private Response handleCreateConfigurationSet(MultivaluedMap<String, String> params, String region) {
|
||||
String name = getParam(params, "ConfigurationSet.Name");
|
||||
if (name == null || name.isBlank()) {
|
||||
|
||||
@@ -3,12 +3,15 @@ package io.github.hectorvent.floci.services.ses;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.storage.StorageBackend;
|
||||
import io.github.hectorvent.floci.core.storage.StorageFactory;
|
||||
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntry;
|
||||
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntryResult;
|
||||
import io.github.hectorvent.floci.services.ses.model.ConfigurationSet;
|
||||
import io.github.hectorvent.floci.services.ses.model.EmailTemplate;
|
||||
import io.github.hectorvent.floci.services.ses.model.Identity;
|
||||
import io.github.hectorvent.floci.services.ses.model.SentEmail;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import org.jboss.logging.Logger;
|
||||
@@ -30,6 +33,9 @@ public class SesService {
|
||||
|
||||
private static final Pattern TEMPLATE_VARIABLE = Pattern.compile("\\{\\{\\s*([\\w-]+)\\s*\\}\\}");
|
||||
|
||||
private static final int MAX_BULK_DESTINATIONS = 50;
|
||||
private static final int MAX_RECIPIENTS_PER_DESTINATION = 50;
|
||||
|
||||
private final StorageBackend<String, Identity> identityStore;
|
||||
private final StorageBackend<String, SentEmail> emailStore;
|
||||
private final StorageBackend<String, Boolean> accountSettingsStore;
|
||||
@@ -428,6 +434,98 @@ public class SesService {
|
||||
region);
|
||||
}
|
||||
|
||||
public List<BulkEmailEntryResult> sendBulkTemplatedEmail(String source,
|
||||
List<String> replyToAddresses,
|
||||
String subject, String textPart, String htmlPart,
|
||||
JsonNode defaultTemplateData,
|
||||
List<BulkEmailEntry> entries,
|
||||
String region) {
|
||||
if (source == null || source.isBlank()) {
|
||||
throw new AwsException("InvalidParameterValue", "Source email is required.", 400);
|
||||
}
|
||||
boolean hasSubject = subject != null && !subject.isBlank();
|
||||
boolean hasText = textPart != null && !textPart.isBlank();
|
||||
boolean hasHtml = htmlPart != null && !htmlPart.isBlank();
|
||||
if (!hasSubject && !hasText && !hasHtml) {
|
||||
throw new AwsException("InvalidTemplate",
|
||||
"Template must have at least a subject, text, or html part.", 400);
|
||||
}
|
||||
if (entries == null || entries.isEmpty()) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"At least one destination entry is required.", 400);
|
||||
}
|
||||
if (entries.size() > MAX_BULK_DESTINATIONS) {
|
||||
throw new AwsException("MessageRejected",
|
||||
"Number of destinations (" + entries.size() + ") exceeds the maximum of "
|
||||
+ MAX_BULK_DESTINATIONS + ".", 400);
|
||||
}
|
||||
for (BulkEmailEntry entry : entries) {
|
||||
int recipientCount = sizeOf(entry.toAddresses())
|
||||
+ sizeOf(entry.ccAddresses())
|
||||
+ sizeOf(entry.bccAddresses());
|
||||
if (recipientCount > MAX_RECIPIENTS_PER_DESTINATION) {
|
||||
throw new AwsException("MessageRejected",
|
||||
"Recipient count (" + recipientCount + ") in a destination exceeds the maximum of "
|
||||
+ MAX_RECIPIENTS_PER_DESTINATION + ".", 400);
|
||||
}
|
||||
}
|
||||
|
||||
List<BulkEmailEntryResult> results = new ArrayList<>(entries.size());
|
||||
for (BulkEmailEntry entry : entries) {
|
||||
try {
|
||||
JsonNode merged = mergeTemplateData(defaultTemplateData, entry.replacementTemplateData());
|
||||
String messageId = sendEmail(source,
|
||||
entry.toAddresses(), entry.ccAddresses(), entry.bccAddresses(),
|
||||
replyToAddresses,
|
||||
applyTemplateData(subject, merged),
|
||||
applyTemplateData(textPart, merged),
|
||||
applyTemplateData(htmlPart, merged),
|
||||
region);
|
||||
results.add(BulkEmailEntryResult.success(messageId));
|
||||
} catch (AwsException e) {
|
||||
results.add(BulkEmailEntryResult.failure(
|
||||
mapErrorCodeToBulkStatus(e.getErrorCode()), e.getMessage()));
|
||||
} catch (Exception e) {
|
||||
results.add(BulkEmailEntryResult.failure(BulkEmailEntryResult.Status.FAILED, e.getMessage()));
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private static int sizeOf(List<?> list) {
|
||||
return list == null ? 0 : list.size();
|
||||
}
|
||||
|
||||
static BulkEmailEntryResult.Status mapErrorCodeToBulkStatus(String errorCode) {
|
||||
if ("InvalidParameterValue".equals(errorCode)) {
|
||||
return BulkEmailEntryResult.Status.INVALID_PARAMETER;
|
||||
}
|
||||
return BulkEmailEntryResult.Status.FAILED;
|
||||
}
|
||||
|
||||
static JsonNode mergeTemplateData(JsonNode defaults, JsonNode replacement) {
|
||||
boolean hasDefault = defaults != null && defaults.isObject();
|
||||
boolean hasReplacement = replacement != null && replacement.isObject();
|
||||
if (!hasDefault && !hasReplacement) {
|
||||
return null;
|
||||
}
|
||||
if (!hasReplacement) {
|
||||
return defaults;
|
||||
}
|
||||
if (!hasDefault) {
|
||||
return replacement;
|
||||
}
|
||||
if (replacement.isEmpty()) {
|
||||
return defaults;
|
||||
}
|
||||
if (defaults.isEmpty()) {
|
||||
return replacement;
|
||||
}
|
||||
ObjectNode merged = ((ObjectNode) defaults).deepCopy();
|
||||
replacement.fields().forEachRemaining(e -> merged.set(e.getKey(), e.getValue()));
|
||||
return merged;
|
||||
}
|
||||
|
||||
static String applyTemplateData(String text, JsonNode data) {
|
||||
if (text == null || text.isEmpty()) {
|
||||
return text;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package io.github.hectorvent.floci.services.ses.model;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RegisterForReflection
|
||||
public record BulkEmailEntry(
|
||||
List<String> toAddresses,
|
||||
List<String> ccAddresses,
|
||||
List<String> bccAddresses,
|
||||
JsonNode replacementTemplateData
|
||||
) {}
|
||||
@@ -0,0 +1,66 @@
|
||||
package io.github.hectorvent.floci.services.ses.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
@RegisterForReflection
|
||||
public class BulkEmailEntryResult {
|
||||
|
||||
public enum Status {
|
||||
SUCCESS,
|
||||
MESSAGE_REJECTED,
|
||||
MAIL_FROM_DOMAIN_NOT_VERIFIED,
|
||||
CONFIGURATION_SET_DOES_NOT_EXIST,
|
||||
TEMPLATE_DOES_NOT_EXIST,
|
||||
ACCOUNT_SUSPENDED,
|
||||
ACCOUNT_THROTTLED,
|
||||
ACCOUNT_DAILY_QUOTA_EXCEEDED,
|
||||
INVALID_SENDING_POOL_NAME,
|
||||
ACCOUNT_SENDING_PAUSED,
|
||||
CONFIGURATION_SET_SENDING_PAUSED,
|
||||
INVALID_PARAMETER,
|
||||
TRANSIENT_FAILURE,
|
||||
FAILED;
|
||||
|
||||
public String toV1String() {
|
||||
if (this == INVALID_PARAMETER) {
|
||||
return "InvalidParameterValue";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String part : name().split("_")) {
|
||||
sb.append(part.charAt(0));
|
||||
sb.append(part.substring(1).toLowerCase());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
private final Status status;
|
||||
private final String messageId;
|
||||
private final String error;
|
||||
|
||||
private BulkEmailEntryResult(Status status, String messageId, String error) {
|
||||
this.status = status;
|
||||
this.messageId = messageId;
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
public static BulkEmailEntryResult success(String messageId) {
|
||||
return new BulkEmailEntryResult(Status.SUCCESS, messageId, null);
|
||||
}
|
||||
|
||||
public static BulkEmailEntryResult failure(Status status, String error) {
|
||||
return new BulkEmailEntryResult(status, null, error);
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getMessageId() {
|
||||
return messageId;
|
||||
}
|
||||
|
||||
public String getError() {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user