How to create .msg file in java using javax mail API - jakarta-mail

I just wanted to know, is it possible to create .msg file(that can be opened using ms-outlook) using javax mail API.
Thanks.

I believe a .msg file is in a Microsoft proprietary format; there's no easy way to create such a file with JavaMail.
However, Outlook might be able to read a .eml file, which is in MIME standard format. JavaMail can create such a file using the Message.writeTo method.

There is a project on javamail.
The module javamail-file-transport is a JavaMail transport that creates msg files on local disk instead of sending real email.
GitHub: https://github.com/m-szalik/javamail

Hi, can we create an .eml file that cen be opened using outlook.If yes then how...
You can open files from the command line in Outlook. Search for Command-line switches for Outlook There is a undocumented /eml switch that can be used to open the MIME standard format. For example, outlook /eml filename.eml
There is a documented /f switch which will open msg files. For example outlook /f filename.msg

Other alternatives:
Free: jotlmsg
Commercial: Aspose.Email

Related

Access files on website (http) similar to ftp

We have an issue with a FTP site that fails intermittently. Upon notification that a connection cannot be established we manually log into a website and upload our file. We have no idea why the FTP site fails and it is not under our control. This community has some good ideas so I am asking if a website (http) can be logged into programmatically and files can be uploaded to or downloaded from that website in a manner similar to ftp. No API available from this vendor.
You did not give specifics about your environment or how you wish to implement your uploads. There are many tools available on most platforms to programmatically upload files, so I'll just mention a few general tips.
There is a very useful Linux GNU shell utility, wget: https://www.gnu.org/software/wget/, that has been available for a very long time. This utility has a command line interface which can easily be accessed programmatically from scripts using exec or other shell commands, to upload files via HTTP and FTP.
It's not as common, but there is a corresponding utility, wput: http://wput.sourceforge.net/, that is used to upload files.
If you only have access to Windows computers, a similar functionality is available from the Windows PowerShell (it's built in). Here is an old SO post with examples of how to do it with PowerShell: How to script FTP upload and download?
Another Windows based utility is WINSCP: https://winscp.net/eng/docs/guide_automation.
In answer to your question, these utilities wget/wput, PowerShell, and WINSCP, could be used to programmatically upload and download files to your FTP site. You could write (or have written) a custom script that automatically retries in the event that you get failures from your flaky FTP site.

Editing Google Docs Files Through Batch File

Is it possible to edit a text file (*.txt) that's public for editing in google Docs through Cmd or a batch file. Or Can I use the FTP Command? It can even be done by uploading and downloading the same file (Download, Edit, Upload).
I have made the Document That I want to add text to and re-upload it per say. https://drive.google.com/file/d/0B0qbLnCcNlcMQ1VSQkFoSmJxc1k/view?usp=sharing
As well as the ftp side goes, afaik google docs don't support ftp access
But a 3rd party program called Cyberduck comes handy at this point
So passing some arguments to cyberduck might do the trick
But if you also want to access a 3rd party ftp server
than it is also possible using the ftp command

How to check if IMAPFolder is hidden?

How may I check if a javax.mail.Folder or com.sun.mail.imap.IMAPFolder object in JavaMail API represents a hidden folder?
There's no universal notion of "hidden folder".
If your IMAP server is using UNIX files, you can check that the folder/file name starts with a dot.
What sort of IMAP server are you using? Do you have existing folders that are "hidden"?

Script to Specify the FTP File Path

Anyone know if I can specify the file path for an FTP upload or script it if there isnt an FTP option to do this in a program? I'm using ScreenPresso Screenshot Software but the FTP Upload doesnt have an option to send it to a certain file path but there is a Scripting option that the program supports. I have no idea what coding is used. Any ideas?
when you specify your ftp address include the subfolders as well as
ftp://foo/bar/baz/qux
Other than that you could try asking their support.

Send Office Open XML file in response

I'm trying to send the content of an Open Office XML file in the response but I can't get the browser to recognize the file and open it with word. It keeps opening it as it was an XML file. I've tried setting the content type to both application/msword and application/vnd.openxmlformats-officedocument.wordprocessingml.document, I've also tried setting the extension to doc and docx, but nothing seems to work.
It sounds like you may be confusing "Open Office" documents with MS Office "Open XML" documents.
The former is a truly open standard (OpenDocument), which can be a single XML file, but is typically a Zipped archive of xml files and binary attachments.
The latter is a similar, but different format, that has been through the standardization process (it is an official ECMA standard), but which has gotten little adoption outside of the MS Office suite. The standardization process was very political - I'll leave it to you to look it up if you are interested.
MS Word, since 2007 SP2 can open OpenDocument (Open Office) .odt files, but I don't think that it works with the single-xml format.
So, try the .odt format.
Also, be aware that Internet Explorer tends to ignore MIME Type, and uses the file extension instead. So you should set the correct MIME Type: application/vnd.oasis.opendocument.text
and set the file name to something ending in ".odt"

Resources