Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,8 @@ public void getInboundRoute() {

### Create an inbound route

Call `includeAttachments(false)` to drop attachments before the message is forwarded. It defaults to `true`. Inline (CID) parts count as attachments, so images embedded in an HTML body are dropped too.

```java
import com.mailersend.sdk.MailerSend;
import com.mailersend.sdk.exceptions.MailerSendException;
Expand All @@ -932,6 +934,7 @@ public void createInboundRoute() {
.domainEnabled(false)
.matchFilter("match_all")
.forwards(new Forward[] { forward })
.includeAttachments(false)
.addRoute();

} catch (MailerSendException e) {
Expand All @@ -944,6 +947,8 @@ public void createInboundRoute() {

### Update an inbound route

Leaving `includeAttachments()` unset keeps the route's stored value; the API does not reset it to `true`. Pass `false` explicitly to drop attachments.

```java
import com.mailersend.sdk.MailerSend;
import com.mailersend.sdk.exceptions.MailerSendException;
Expand All @@ -969,6 +974,7 @@ public void updateInboundRoute() {
.domainEnabled(false)
.matchFilter("match_all")
.forwards(new Forward[] { forward })
.includeAttachments(true)
.updateRoute("inbound route id");

System.out.println(route.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class InboundRoute {
@SerializedName("priority")
public int priority;

@SerializedName("include_attachments")
public boolean includeAttachments;


/**
* <p>postDeserialize.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,22 @@ public InboundRouteBuilder forwards(Forward[] forwards) {
builderBody.forwards = forwards;
return this;
}

/**
* <p>includeAttachments.</p>
*
* <p>Forwards attachments with the message. Defaults to {@code true}. Set it to
* {@code false} to drop them before the message is forwarded; inline (CID) parts count as
* attachments, so images embedded in an HTML body are dropped too. Leaving this unset on
* an update keeps the route's stored value.</p>
*
* @param includeAttachments a boolean.
* @return a {@link com.mailersend.sdk.inboundroutes.InboundRouteBuilder} object.
*/
public InboundRouteBuilder includeAttachments(boolean includeAttachments) {
builderBody.includeAttachments = includeAttachments;
return this;
}


private static final String[] VALID_CATCH_FILTER_TYPES = {"catch_all", "catch_recipient"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ public class InboundRouteBuilderBody {
@SerializedName("forwards")
public Forward[] forwards;

/**
* Optional. Boxed so an unset value is omitted from the request body: the API keeps
* the route's stored value when the key is absent, and rejects an explicit null.
*/
@SerializedName("include_attachments")
public Boolean includeAttachments;

/**
* <p>reset.</p>
*/
Expand All @@ -71,5 +78,6 @@ public void reset() {
matchFilter = null;
matchType = null;
forwards = null;
includeAttachments = null;
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"b8a0377fe05e24ddd4159a4076934d0e3fb8dad1":{"body":"{\"data\":{\"id\":\"jpr9084z9xlw63dn\",\"name\":\"Test inbound name\",\"address\":\"emcbcwyz41fdrr7uuiz1@inbound.mailersend.net\",\"domain\":null,\"dns_checked_at\":null,\"enabled\":true,\"filters\":[{\"type\":\"match_all\",\"key\":null,\"comparer\":null,\"value\":null}],\"forwards\":[{\"type\":\"webhook\",\"value\":\"https:\\/\\/example-domain.com\",\"secret\":\"FRwZFJCkf7nbydrn0oq9uLc76USD4iaI\"}],\"mxValues\":{\"priority\":\"10\",\"target\":\"inbound.mailersend.net\"}}}","headers":{":status":["201"],"cache-control":["no-cache, private"],"cf-cache-status":["DYNAMIC"],"cf-ray":["73d3b22358826f68-ATH"],"content-type":["application/json"],"date":["Fri, 19 Aug 2022 14:49:26 GMT"],"expect-ct":["max-age\u003d604800, report-uri\u003d\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\""],"server":["cloudflare"],"strict-transport-security":["max-age\u003d15724800; includeSubDomains"],"x-apiquota-remaining":["-1"],"x-apiquota-reset":["2022-08-20T00:00:00Z"],"x-ratelimit-limit":["60"],"x-ratelimit-remaining":["57"]},"statusCode":201}}
{"b8a0377fe05e24ddd4159a4076934d0e3fb8dad1":{"body":"{\"data\":{\"id\":\"jpr9084z9xlw63dn\",\"name\":\"Test inbound name\",\"address\":\"emcbcwyz41fdrr7uuiz1@inbound.mailersend.net\",\"domain\":null,\"dns_checked_at\":null,\"enabled\":true,\"filters\":[{\"type\":\"match_all\",\"key\":null,\"comparer\":null,\"value\":null}],\"forwards\":[{\"type\":\"webhook\",\"value\":\"https:\\/\\/example-domain.com\",\"secret\":\"FRwZFJCkf7nbydrn0oq9uLc76USD4iaI\"}],\"mxValues\":{\"priority\":\"10\",\"target\":\"inbound.mailersend.net\"},\"include_attachments\":true}}","headers":{":status":["201"],"cache-control":["no-cache, private"],"cf-cache-status":["DYNAMIC"],"cf-ray":["73d3b22358826f68-ATH"],"content-type":["application/json"],"date":["Fri, 19 Aug 2022 14:49:26 GMT"],"expect-ct":["max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\""],"server":["cloudflare"],"strict-transport-security":["max-age=15724800; includeSubDomains"],"x-apiquota-remaining":["-1"],"x-apiquota-reset":["2022-08-20T00:00:00Z"],"x-ratelimit-limit":["60"],"x-ratelimit-remaining":["57"]},"statusCode":201}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"da3edc8bde57193e98e999a2ac1899738b69b5b5":{"body":"{\"data\":[{\"id\":\"x3vz9dleq7lkj50y\",\"name\":\"test\",\"address\":\"fqs5shof9gvwsxs7hwaz@inbound.mailersend.net\",\"domain\":null,\"dns_checked_at\":null,\"enabled\":true,\"filters\":[{\"type\":\"match_all\",\"key\":null,\"comparer\":null,\"value\":null}],\"forwards\":[{\"type\":\"webhook\",\"value\":\"https:\\/\\/api-003.mailerlite.dev\",\"secret\":\"yAI5fwx9hR0K4gzeOxW6YBrMcoHtLtoc\"}],\"mxValues\":{\"priority\":\"10\",\"target\":\"inbound.mailersend.net\"}},{\"id\":\"83yxj6ljoq4do2rm\",\"name\":\"Test inbound name\",\"address\":\"vxlarh7vthhnagf3zved@inbound.mailersend.net\",\"domain\":null,\"dns_checked_at\":null,\"enabled\":true,\"filters\":[{\"type\":\"match_all\",\"key\":null,\"comparer\":null,\"value\":null}],\"forwards\":[{\"type\":\"webhook\",\"value\":\"https:\\/\\/example.com\",\"secret\":\"9IAyXyE6eAg2pre8QQfvcs3VPJSS8iaW\"}],\"mxValues\":{\"priority\":\"10\",\"target\":\"inbound.mailersend.net\"}},{\"id\":\"jpr9084z9xlw63dn\",\"name\":\"Test inbound name\",\"address\":\"emcbcwyz41fdrr7uuiz1@inbound.mailersend.net\",\"domain\":null,\"dns_checked_at\":null,\"enabled\":true,\"filters\":[{\"type\":\"match_all\",\"key\":null,\"comparer\":null,\"value\":null}],\"forwards\":[{\"type\":\"webhook\",\"value\":\"https:\\/\\/example-domain.com\",\"secret\":\"FRwZFJCkf7nbydrn0oq9uLc76USD4iaI\"}],\"mxValues\":{\"priority\":\"10\",\"target\":\"inbound.mailersend.net\"}}],\"links\":{\"first\":\"https:\\/\\/api.mailersend.com\\/v1\\/inbound?page\u003d1\",\"last\":\"https:\\/\\/api.mailersend.com\\/v1\\/inbound?page\u003d1\",\"prev\":null,\"next\":null},\"meta\":{\"current_page\":1,\"from\":1,\"last_page\":1,\"links\":[{\"url\":null,\"label\":\"\u0026laquo; Previous\",\"active\":false},{\"url\":\"https:\\/\\/api.mailersend.com\\/v1\\/inbound?page\u003d1\",\"label\":\"1\",\"active\":true},{\"url\":null,\"label\":\"Next \u0026raquo;\",\"active\":false}],\"path\":\"https:\\/\\/api.mailersend.com\\/v1\\/inbound\",\"per_page\":25,\"to\":3,\"total\":3}}","headers":{":status":["200"],"cache-control":["no-cache, private"],"cf-cache-status":["DYNAMIC"],"cf-ray":["73d3b63a9a016f5f-ATH"],"content-type":["application/json"],"date":["Fri, 19 Aug 2022 14:52:14 GMT"],"expect-ct":["max-age\u003d604800, report-uri\u003d\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\""],"server":["cloudflare"],"strict-transport-security":["max-age\u003d15724800; includeSubDomains"],"x-apiquota-remaining":["-1"],"x-apiquota-reset":["2022-08-20T00:00:00Z"],"x-ratelimit-limit":["60"],"x-ratelimit-remaining":["59"]},"statusCode":200}}
{"da3edc8bde57193e98e999a2ac1899738b69b5b5":{"body":"{\"data\":[{\"id\":\"x3vz9dleq7lkj50y\",\"name\":\"test\",\"address\":\"fqs5shof9gvwsxs7hwaz@inbound.mailersend.net\",\"domain\":null,\"dns_checked_at\":null,\"enabled\":true,\"filters\":[{\"type\":\"match_all\",\"key\":null,\"comparer\":null,\"value\":null}],\"forwards\":[{\"type\":\"webhook\",\"value\":\"https:\\/\\/api-003.mailerlite.dev\",\"secret\":\"yAI5fwx9hR0K4gzeOxW6YBrMcoHtLtoc\"}],\"mxValues\":{\"priority\":\"10\",\"target\":\"inbound.mailersend.net\"},\"include_attachments\":true},{\"id\":\"83yxj6ljoq4do2rm\",\"name\":\"Test inbound name\",\"address\":\"vxlarh7vthhnagf3zved@inbound.mailersend.net\",\"domain\":null,\"dns_checked_at\":null,\"enabled\":true,\"filters\":[{\"type\":\"match_all\",\"key\":null,\"comparer\":null,\"value\":null}],\"forwards\":[{\"type\":\"webhook\",\"value\":\"https:\\/\\/example.com\",\"secret\":\"9IAyXyE6eAg2pre8QQfvcs3VPJSS8iaW\"}],\"mxValues\":{\"priority\":\"10\",\"target\":\"inbound.mailersend.net\"},\"include_attachments\":true},{\"id\":\"jpr9084z9xlw63dn\",\"name\":\"Test inbound name\",\"address\":\"emcbcwyz41fdrr7uuiz1@inbound.mailersend.net\",\"domain\":null,\"dns_checked_at\":null,\"enabled\":true,\"filters\":[{\"type\":\"match_all\",\"key\":null,\"comparer\":null,\"value\":null}],\"forwards\":[{\"type\":\"webhook\",\"value\":\"https:\\/\\/example-domain.com\",\"secret\":\"FRwZFJCkf7nbydrn0oq9uLc76USD4iaI\"}],\"mxValues\":{\"priority\":\"10\",\"target\":\"inbound.mailersend.net\"},\"include_attachments\":true}],\"links\":{\"first\":\"https:\\/\\/api.mailersend.com\\/v1\\/inbound?page=1\",\"last\":\"https:\\/\\/api.mailersend.com\\/v1\\/inbound?page=1\",\"prev\":null,\"next\":null},\"meta\":{\"current_page\":1,\"from\":1,\"last_page\":1,\"links\":[{\"url\":null,\"label\":\"&laquo; Previous\",\"active\":false},{\"url\":\"https:\\/\\/api.mailersend.com\\/v1\\/inbound?page=1\",\"label\":\"1\",\"active\":true},{\"url\":null,\"label\":\"Next &raquo;\",\"active\":false}],\"path\":\"https:\\/\\/api.mailersend.com\\/v1\\/inbound\",\"per_page\":25,\"to\":3,\"total\":3}}","headers":{":status":["200"],"cache-control":["no-cache, private"],"cf-cache-status":["DYNAMIC"],"cf-ray":["73d3b63a9a016f5f-ATH"],"content-type":["application/json"],"date":["Fri, 19 Aug 2022 14:52:14 GMT"],"expect-ct":["max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\""],"server":["cloudflare"],"strict-transport-security":["max-age=15724800; includeSubDomains"],"x-apiquota-remaining":["-1"],"x-apiquota-reset":["2022-08-20T00:00:00Z"],"x-ratelimit-limit":["60"],"x-ratelimit-remaining":["59"]},"statusCode":200}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"981d4a16b72bd8c0fba5563dabfb4f5498c48ae9":{"body":"{\"data\":{\"id\":\"83yxj6ljoq4do2rm\",\"name\":\"Test inbound name\",\"address\":\"vxlarh7vthhnagf3zved@inbound.mailersend.net\",\"domain\":null,\"dns_checked_at\":null,\"enabled\":true,\"filters\":[{\"type\":\"match_all\",\"key\":null,\"comparer\":null,\"value\":null}],\"forwards\":[{\"type\":\"webhook\",\"value\":\"https:\\/\\/example.com\",\"secret\":\"9IAyXyE6eAg2pre8QQfvcs3VPJSS8iaW\"}],\"mxValues\":{\"priority\":\"10\",\"target\":\"inbound.mailersend.net\"}}}","headers":{":status":["200"],"cache-control":["no-cache, private"],"cf-cache-status":["DYNAMIC"],"cf-ray":["73d3ba6eded638c9-ATH"],"content-type":["application/json"],"date":["Fri, 19 Aug 2022 14:55:06 GMT"],"expect-ct":["max-age\u003d604800, report-uri\u003d\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\""],"server":["cloudflare"],"strict-transport-security":["max-age\u003d15724800; includeSubDomains"],"x-apiquota-remaining":["-1"],"x-apiquota-reset":["2022-08-20T00:00:00Z"],"x-ratelimit-limit":["60"],"x-ratelimit-remaining":["59"]},"statusCode":200}}
{"981d4a16b72bd8c0fba5563dabfb4f5498c48ae9":{"body":"{\"data\":{\"id\":\"83yxj6ljoq4do2rm\",\"name\":\"Test inbound name\",\"address\":\"vxlarh7vthhnagf3zved@inbound.mailersend.net\",\"domain\":null,\"dns_checked_at\":null,\"enabled\":true,\"filters\":[{\"type\":\"match_all\",\"key\":null,\"comparer\":null,\"value\":null}],\"forwards\":[{\"type\":\"webhook\",\"value\":\"https:\\/\\/example.com\",\"secret\":\"9IAyXyE6eAg2pre8QQfvcs3VPJSS8iaW\"}],\"mxValues\":{\"priority\":\"10\",\"target\":\"inbound.mailersend.net\"},\"include_attachments\":true}}","headers":{":status":["200"],"cache-control":["no-cache, private"],"cf-cache-status":["DYNAMIC"],"cf-ray":["73d3ba6eded638c9-ATH"],"content-type":["application/json"],"date":["Fri, 19 Aug 2022 14:55:06 GMT"],"expect-ct":["max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\""],"server":["cloudflare"],"strict-transport-security":["max-age=15724800; includeSubDomains"],"x-apiquota-remaining":["-1"],"x-apiquota-reset":["2022-08-20T00:00:00Z"],"x-ratelimit-limit":["60"],"x-ratelimit-remaining":["59"]},"statusCode":200}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"1aff61f4d4446105b742718ccb14f912cd075602":{"body":"{\"data\":{\"id\":\"83yxj6ljoq4do2rm\",\"name\":\"Updated route name\",\"address\":\"vxlarh7vthhnagf3zved@inbound.mailersend.net\",\"domain\":null,\"dns_checked_at\":null,\"enabled\":true,\"filters\":[{\"type\":\"match_all\",\"key\":null,\"comparer\":null,\"value\":null}],\"forwards\":[{\"type\":\"webhook\",\"value\":\"https:\\/\\/example.com\",\"secret\":\"9IAyXyE6eAg2pre8QQfvcs3VPJSS8iaW\"}],\"mxValues\":{\"priority\":\"10\",\"target\":\"inbound.mailersend.net\"}}}","headers":{":status":["200"],"cache-control":["no-cache, private"],"cf-cache-status":["DYNAMIC"],"cf-ray":["73d3bf27ad6238d6-ATH"],"content-type":["application/json"],"date":["Fri, 19 Aug 2022 14:58:19 GMT"],"expect-ct":["max-age\u003d604800, report-uri\u003d\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\""],"server":["cloudflare"],"strict-transport-security":["max-age\u003d15724800; includeSubDomains"],"x-apiquota-remaining":["-1"],"x-apiquota-reset":["2022-08-20T00:00:00Z"],"x-ratelimit-limit":["60"],"x-ratelimit-remaining":["59"]},"statusCode":200}}
{"1aff61f4d4446105b742718ccb14f912cd075602":{"body":"{\"data\":{\"id\":\"83yxj6ljoq4do2rm\",\"name\":\"Updated route name\",\"address\":\"vxlarh7vthhnagf3zved@inbound.mailersend.net\",\"domain\":null,\"dns_checked_at\":null,\"enabled\":true,\"filters\":[{\"type\":\"match_all\",\"key\":null,\"comparer\":null,\"value\":null}],\"forwards\":[{\"type\":\"webhook\",\"value\":\"https:\\/\\/example.com\",\"secret\":\"9IAyXyE6eAg2pre8QQfvcs3VPJSS8iaW\"}],\"mxValues\":{\"priority\":\"10\",\"target\":\"inbound.mailersend.net\"},\"include_attachments\":true}}","headers":{":status":["200"],"cache-control":["no-cache, private"],"cf-cache-status":["DYNAMIC"],"cf-ray":["73d3bf27ad6238d6-ATH"],"content-type":["application/json"],"date":["Fri, 19 Aug 2022 14:58:19 GMT"],"expect-ct":["max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\""],"server":["cloudflare"],"strict-transport-security":["max-age=15724800; includeSubDomains"],"x-apiquota-remaining":["-1"],"x-apiquota-reset":["2022-08-20T00:00:00Z"],"x-ratelimit-limit":["60"],"x-ratelimit-remaining":["59"]},"statusCode":200}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"ad464b3b9851abf34d634bda2b845511b51fad7e":{"body":"{\"data\":{\"id\":\"jpr9084z9xlw63dn\",\"name\":\"Test inbound name\",\"address\":\"emcbcwyz41fdrr7uuiz1@inbound.mailersend.net\",\"domain\":null,\"dns_checked_at\":null,\"enabled\":true,\"filters\":[{\"type\":\"match_all\",\"key\":null,\"comparer\":null,\"value\":null}],\"forwards\":[],\"mxValues\":{\"priority\":\"10\",\"target\":\"inbound.mailersend.net\"}}}","headers":{":status":["201"],"cache-control":["no-cache, private"],"content-type":["application/json"],"date":["Fri, 19 Aug 2022 14:49:26 GMT"],"server":["cloudflare"]},"statusCode":201}}
{"ad464b3b9851abf34d634bda2b845511b51fad7e":{"body":"{\"data\":{\"id\":\"jpr9084z9xlw63dn\",\"name\":\"Test inbound name\",\"address\":\"emcbcwyz41fdrr7uuiz1@inbound.mailersend.net\",\"domain\":null,\"dns_checked_at\":null,\"enabled\":true,\"filters\":[{\"type\":\"match_all\",\"key\":null,\"comparer\":null,\"value\":null}],\"forwards\":[],\"mxValues\":{\"priority\":\"10\",\"target\":\"inbound.mailersend.net\"},\"include_attachments\":true}}","headers":{":status":["201"],"cache-control":["no-cache, private"],"content-type":["application/json"],"date":["Fri, 19 Aug 2022 14:49:26 GMT"],"server":["cloudflare"]},"statusCode":201}}
Loading