Comments (7)
Hi,
thank you for contacting us back regarding the library. The main reason behind that is avoiding mistakes when doing attachments creation on the fly. Its much easier to make sure attachment is correct by having it in the file, and allowing the library to read, encode and send it for you.
We can add overload method for adding attachments on fly too. Could you share example on how you plan to add attachments on the fly, so we have better idea on whether its a good fit to add to the model?
from postmark-java.
Scenario : provide a "copy" of the content of the email as a CSV file attachment. In that case it doesn't make sense for me to create a temporary file that would then be read by Postmark API.
Maybe an InputStream
? (i.e. ByteArrayInputStream
), that could be useful for files too...
from postmark-java.
Hey @jflebeau
Got it, I will be doing some updates to library this week. Will tackle adding attachments on the fly too.
from postmark-java.
oops, you are right, added it for regular messages only. Updated TemplatedMessage model too, should be up in less than an hour.
from postmark-java.
Hi @jflebeau
I was checking out today the model for messages and you can actually attach attachments on fly.
There is support for it.
Check out the following example:
Message message = new Message("[email protected]", "[email protected]", "Subject", "Body");
String test = "test message line 1\ntest message line 2";
HashMap<String,String> attachment = new HashMap<>();
attachment.put("Name", "filename.txt");
attachment.put("Content", Base64.getEncoder().encodeToString(test.getBytes()));
attachment.put("ContentType", "text");
message.addAttachment(attachment);
I will add though additional helpers and update documentation to make it clearer. Many thanks on catching that and using the library!
and then send the message.
from postmark-java.
Hi @jflebeau
the library has been updated. You should be able to easily attach content on the fly with couple of new options. Check out the wiki for details:
https://github.com/wildbit/postmark-java/wiki/Email-sending
from postmark-java.
This method doesn't exist for TemplateMessage
.
from postmark-java.
Related Issues (20)
- Naming inconsistancy: Bounce.java is the only class using getMessageID instead of getMessageId HOT 2
- Some methods were not updated to handle the new JSON error code & error message responses HOT 1
- Java 9: Illegal reflective access warning caused by JAXB dependency HOT 8
- [1.5.6] ProcessingException after upgrading from 1.5.5 to 1.5.6 HOT 10
- log4j2.properties overriding log4j2 configuration HOT 1
- Logging dependencies HOT 5
- Feature Request - support custom jackson object mapper HOT 3
- `message.addHeader` function not backwards compatible HOT 2
- Updated dependencies with high vulnerabilities HOT 1
- Allowing comma separated emails HOT 5
- HeaderValueException:Too many "Content-Type" header values: "[application/json, application/json]" HOT 13
- HeaderValueException:Too many "Content-Type" header values: "[application/json, application/json]" HOT 2
- HeaderValueException:Too many "Content-Type" header values: "[application/json, application/json] HOT 2
- Apache Tika vulnerabilities HOT 2
- Version `1.8.2` introduces `slf4j-simple` dependency HOT 2
- Upgrade Apache Tika to address vulnerability HOT 2
- Improve error handling, when HTTP status is unknown HOT 1
- Is ApiClient threadsafe? HOT 3
- Support for Jakarta EE HOT 2
- Spring Boot random "SSLException: Connection Reset" with Java 8 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postmark-java.