I can download attachments from an email account using JavaMail API. But is there any way to get the download links of the attachments of an email using Java?
For my purpose, I need to get the download links of the attachments and provide them to user. So that the user can download those attachments directly from email server. I will highly appreciate any other kind of suggestion.
The attachments in the email are the integral part of an email. It is just another MIME part in the email. You won't be able to get directly the attachment as a web resource.
To do so you can parse the email and store the attachment on the filestore and then provide it as a web resource.
Related
I'm trying to send an email with an attachment that will be an email in format .eml using Mailjet Send API with java (Java 8).
I have the email I want to attach in raw format (obtained using the Gmail API) and I try to add it to the main email as the Mailjet documentation says, but when I try to open the email attached, I get the following error:
I tried to open the email with the Thunderbird client too, and it shows me strange content, as if the .eml file were corrupted.
I think that I'm adding the attachment correctly to the email that will be sent, following the format indicated in the documentation. The variable raw is the string that has the email I want to send as an .EML file.
I don't know if the problem is related to the way Mailjet creates the eml attachment, or because how Gmail API give me the raw email.
I am developing a web application using Oracle ADF and jdeveloper11.1.2.4. In that I have a form to send a mail with required input fields. Example toAddress, ccAddress and attachemnt Location(input text field). I am sending mails using java mail api. I got this information from the post
Mail using java
My problems is with attachment file. I am able to send an email successfully with attachment if I gave a location of the file that is on server(on which my application has deployed).
Beacause my application is web application user can access through internet. If am trying to add a location of the file that is in local system(Other than server) then file is not getting attached and mail is not getting send.
I am unable to attach a file from other than server.
Please help me. How do I achieve this. User should be able to attache a file from his/her system(local system).
First upload your file to server directory
see- http://www.awasthiashish.com/2014/08/uploading-and-downloading-files-from.html
Then provide a path when sending mail
see-http://www.awasthiashish.com/2013/04/gmail-integration-with-oracle-adf-using.html
First you will have to upload the file to the server and then attach that file in your email as JavaMail will need an absolute path on your current server.
PS: If you are sending emails using java I would highly recommend looking at Apache Commons email library https://commons.apache.org/proper/commons-email/userguide.html
It will make your life a lot easier.
I have a use case where i need to read the content of the mail in outlook inbox and convert it into xml and send it to diffrent system.Is there any library which can help me in parsing the content.
Outlook is the client for the email server.(May be exchange server).
You actually need to connect to the server to read the email.
If you know the server, you can find a API for it.
Checkout this URL if you are trying to access the exchange server:
http://archive.msdn.microsoft.com/ewsjavaapi
Is it possible to send the file as a link instead of attaching the file in the email. I am sending an email using Java . Now, i have a requirement thatI don't want to send the file as an attachement instead I need to send it as a link.
Link will something be like abc.com\report\excel\"fileName", in which abc.com is the host/ machine name, and rest is the path location.
Thanks.
Mail format does't allow meta-attachments (i.e. by reference, not by instance).
Your only option is sending HTML email with HTML link to the file (and of course it should be accessible via internet).
I am developing a Mail Client in Java (JSP and Struts). I have successfully fetched Message header information and stored in my local Database (including Message ID and subject).
When the user views the mails, I fetch the message headers from my database and display them to user. Now when the user click a particular Email, I want to fetch the mail body and file attachments from the Gmail server, directly. I don't want to serially travel through all the mails on the Gmail Server.
I have done this earlier in PHP, where if I pass the message id and I can retrieve the details of that particular mail. Is there any similar functionality in Java Mail API? If not, then can anyone suggest me a solution to this?
You can use Folder#getMessage(int) for this.
Note that the zip file with the JavaMail API which you can download from their side includes a lot of examples in /demo folder, under each a basic(!) Servlet which shows a simple mailbox with this functionality. You may want to build, refactor and expand further based on the simple example.