Comments (14)
from flowcrypt-android.
I tried to use your code for parse raw MIME message. And I have some issues.
-
The file raw_mime_html.txt not parsed correctly. I received
mimeMessage.getText() == null.
Can you see what the problem is? -
If you do not mind, I would like to make the word "date, subject, from, to" as String constants in class
com.flowcrypt.email.test.MimeMessage
-
Can you add the ability to receive dates in timestamp variant (for example 1493972679000)? When I use JavaMail, I received a message date as a Date object. In this case, I can display time in a format convenient for the user, according to his preferences. If I have a timestamp, I can create a Date object manually.
from flowcrypt-android.
from flowcrypt-android.
from flowcrypt-android.
from flowcrypt-android.
Does getHtml() also return null?
No, getHtml() return String.
You can see the screenshot.
from flowcrypt-android.
There you go - this MIME message only contains HTML but no plain text.
This is correct behavior. if message.getText() == null, then you display message.getHtml()
from flowcrypt-android.
from flowcrypt-android.
from flowcrypt-android.
Ok, then I'll change the code according to the comments
from flowcrypt-android.
To answer your questions that I didn't address above:
-
You can change MimeMessage or other classes to your liking. A string constant may make sense for title (although a getter may be better, eg
mm.getTitle()
- up to you). You could also have aLong
for date undermm.getDate()
or justmm.date
etc. Butto
is more complicated - there may be 5 people that the message was sent to. Each person has an email and a name. How do you want to represent it in a string constant? Same thing forfrom
- there is an email and a name as well, one string may not be sufficient. That's why I thought MimeAddress may be a good way to approach it. Let me know what you think, I'm not really a Java person :) -
That is a good idea. I have added this functionality now, you can use it as follows:
MimeMessage m = js.mime_decode(read(context.getAssets().open("sample/message.mime")));
System.out.println("Date:" + m.getTimeHeader("date"));
which will print out Date:1493133431000
. This is UTC time (amount of milliseconds from the epoch), so you will still need to convert it to local timezone.
from flowcrypt-android.
- In this case, I mean for example mimeMessage.getAddressHeader(MimeMessage.HEADER_NAME_FROM) instead mimeMessage.getAddressHeader("from"). In Java it is considered a bad practice to write String in the code that can be used more than once. Therefore, they are rendered into constants to reduce the probability of writing a wrong String (for example with missing chars etc.).
public static final String HEADER_NAME_FROM= "from";
- Very good! I applied this code. It works perfectly.
I close this task. I have no more questions.
from flowcrypt-android.
Good work!
Yes I thought it may be a bad practice in Java.
mimeMessage.getAddressHeader(MimeMessage.HEADER_NAME_FROM)
is perfectly fine and makes sense for the use case, although a bit long :)
Maybe a special class MimeHeader that will just have the constants. Used this way:
mimeMessage.getAddressHeader(MimeHeader.FROM)
mimeMessage.getAddressHeader(MimeHeader.TO)
mimeMessage.getAddressHeader(MimeHeader.SUBJECT)
etc
from flowcrypt-android.
Maybe a special class MimeHeader that will just have the constants.
Yes, I think is a good solution.
from flowcrypt-android.
Related Issues (20)
- Fix tests warnings
- version 1.5.2 release enterprise Feb 7 HOT 1
- Test with Gradle Managed Devices HOT 1
- [Feature Request] Single Sign-On login option HOT 2
- Use SVG instead of PNG
- The setup process for SMTP/IMAP login options cannot be completed after attempting to load the private key file. HOT 7
- Remove unused images HOT 1
- Use SVG as bg_lock_seamless.png
- version 1.5.4(1.5.3 was skipped due to the wrong branch) HOT 2
- Use file schema as source for outgoing messages
- Many com.flowcrypt.email.util.exception.ManualHandledException error reports HOT 1
- App crashes when try to preview an encrypted attachment
- try new Semaphore machines starting from March 1, 2024
- Update compileSdkVersion and targetSdkVersion to 34
- Improve notifications about outgoing messages
- use Document Provider for embedded attachments HOT 1
- Starting FGS without a type' when executing the code on Android 14
- Use Android 14 for CI emulator
- Prevent building the production build from non-master branch
- Fix flaky tests HOT 1
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 flowcrypt-android.