You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When sending a message via the Java library with a recipient-name that has quotes in it, the library doesn't escape it and the API returns an error.
I have to escape the name myself with name.replace("\"", "\\\""), but it would be nice if the library does that for you.
To Reproduce
// this name could be from a database for example, or from an http requestStringname = "A (company)name containing a \" for example";
StringemailAddress = "dummy@example.com";
Messagemessage = newMessage();
// set required fields, e.g. from and body, and then:message.setTo(Map.of(name, emailAddress));
ApiClientapiClient = Postmark.getApiClient(..);
apiClient.deliverMessage(message);
this throws:
com.postmarkapp.postmark.client.exception.InvalidMessageException: Errorparsing'To': Unclosedquotedstring: "A (company)name containing a "forexample"<dummy@example.com>
at com.postmarkapp.postmark.client.HttpClientErrorHandler.throwErrorBasedOnStatusCode(HttpClientErrorHandler.java:37)
at com.postmarkapp.postmark.client.HttpClientHandler.execute(HttpClientHandler.java:67)
at com.postmarkapp.postmark.client.ApiClient.deliverMessage(ApiClient.java:67)
Expected behavior
It would be nice when using the library as follows, that from/to/cc/bcc recipient names are encoded or escaped automatically:
message.setFrom(name, address)
message.setTo(Map.of(name, address))
message.setCc(Map.of(name, address))
message.setBcc(Map.of(name, address))
Java (please complete the following information):
I'm using version 1.11.1 of the library in Java 21
Environment used: Linux/MacOS
The text was updated successfully, but these errors were encountered:
Describe the bug
When sending a message via the Java library with a recipient-name that has quotes in it, the library doesn't escape it and the API returns an error.
I have to escape the name myself with
name.replace("\"", "\\\"")
, but it would be nice if the library does that for you.To Reproduce
this throws:
Expected behavior
It would be nice when using the library as follows, that from/to/cc/bcc recipient names are encoded or escaped automatically:
message.setFrom(name, address)
message.setTo(Map.of(name, address))
message.setCc(Map.of(name, address))
message.setBcc(Map.of(name, address))
Java (please complete the following information):
1.11.1
of the library in Java 21The text was updated successfully, but these errors were encountered: