Java Mail: How to add a Message inside another message - jakarta-mail

I need to add a message as an email attachment to another message(MimeMessage) in java mail. Both parent and attachment messages are created on the fly. I couldn't get any references of how to do this. Can somebody give a pointer?

From the JavaMail FAQ:
How do I forward a message?

Related

Giving a webhook a name Discord.JS

I like using webhooks, and I think they work amazing, but what I can't figure out is giving a webhook a certain name for just one message.
You can do it by setting username in the JSON you send to Discord. The full documentation is available here: https://discord.com/developers/docs/resources/webhook#execute-webhook-jsonform-params

GMAIL API : How to get the reply without the original message

i'm using google api for gmail. All is working fine, i was able to connect, list and get message / thread, browse every elements of a thread etc...
I want to be able to retrieve a reply without the original message, is it somehow doable ?
I think that every email software will put together a different constructed reply message with the original message included but maybe there's a way to retrieve only the reply.
Thanks for any hint that will allow me to do such thing.
It appears the consensus is that this is not possible, and that the message/thread must be parsed manually with your program.

Sending threaded email from Google App Engine

I've got an app that's sending email from AppEngine, but each email looks like it's a unique message. Instead I want related emails to be threaded in my email client. Is there a specific header/format I need to use?
These emails are not necessarily in response to another email, so I don't have a Message-ID to plug into References. I've tried using a natural key in References and In-Reply-To to no avail.
I was able to thread a list of emails just by using the In-Reply-To header with your format <msg-identifier#host>.
Supposedly, msg-identifier is the identifier to the message you're replying to, but as you're not replying to any message but sending all of them out of thin air, creating a new ID and using it in all the emails you send will also do the trick.
I got this working by using both References and In-Reply-To with the format <identifier#systemname>. Maybe it'll work with less; I made several changes at once. If someone chimes in with that kind of detail I'll happily accept their answer instead of mine.

How do I download the screenshots attached in the mail body

My program picks up mail from a PoP3 enabled email exchange server.
This mails have screen shots as part of the body.
I want to save the screenshots in the mail on the local drive.
I am using JavaMail API.
The API doesnot pick up the screenshot as an inline attachment but rather says the mime type of the email message is text/html.
How do I pick up this screenshot using javamail.
All I get is a src:cid
If it's referencing the screenshots using src:cid, the text/html will be one part of a multipart/related and the screenshots will be other parts. You can match up the cid reference with the Content-ID of the parts.

How to read e-mails in a local directory using Java?

I would like to create a java program that would get only the body/message of the mail, the mails are in .eml format and the mails are placed locally in my machine. The problem is when I try to look for ways to do this I'm still lead to use the Folder class which requires an active mail server. Now, my question is, is there any way I can extract the message part of an e-mail using the Javamail API without the need to connect to a server? Because doing the extraction of the message part of an e-mail without including its headers is nearly impossible with filestream.
Thanks for the help.
Cheers!
You can use a "local store provider" for JavaMail, but perhaps the simplest approach for you is to just use the MimeMessage that takes an InputStream. Give it a (buffered) FileInputStream and it will parse the message for you.

Resources