Currently I use JavaMail API to retrieve emails from exchange server inbox using imap.
The exchange server is now migrated to o365 online, and basic authentication is being disabled. So, I need to use OAuth2 and integrate with Microsoft Graph APIs using Microsoft Authentication Library (MSAL) to retrieve the emails from exchange server.
Has someone achieved this and can provide pointers for this integration? I am specifically looking to read emails from a system inbox/account using OAuth2 and Microsoft Graph APIs.
Thanks,
Saurabh
Related
How can I fetch data from JIRA using Java?
What are the steps and ideas?
The program should automatically connect Jira and fetch data
Please help
There are multiple ways to access Jira and you need to differentiate between Jira Cloud and Jira Server (since you didn't specify which one you want to access).
Jira Cloud
Jira Cloud only offers a REST API to communicate. Have a look at the REST API docs (Supported authentication: Basic Auth, JWT, OAuth) or the get started guide to create your own app for Jira Cloud.
Jira Server
Jira Server offers a REST API (Supported authentication: Basic Auth) as well as a Java API to access data. There are also guides to get you started using the Java API by creating your own Jira app for Jira Server.
I am using sendgrid APIs to send bulk emails.We have cloud application in android and web using google app engine.As we know google app engine has limited quota.So we supposed to use FREE i.e.12k/month to send emails.We have integrated it properly.If I run the code at local side i.e. localhost:888, it works but if I deploy the code and try it from there then I am getting below exception.I have created an account on sendgrid already and verified as well.
com.google.apphosting.api.ApiProxy$FeatureNotEnabledException: The
Socket API will be enabled for this application once billing has been
enabled in the admin console
Is it really needed to have billing account?
You can use sendgrids web api which does not require the Socket API in App Engine.
If you want to use sendgrid's SMTP API you will have to enable billing. I would recommend using the web api though.
They have an example i successfully use in one of my projects.
I have looked up Google and Spring documentation but can not find any thing on receiving emails.
I need to build a client (kind of not fully blown client) that can receive emails from POP3 and IMAP. I am already using Spring in the project so preference is Spring.
Lots of links point to James but while it does look like a good project does not provide enough documentation and I am not even sure it does what I am after i.e just a small client that is able to to receive emails.
Spring integration was designed to solve these kind of problems. In particular it has e-mail receiving adapters. Here is an IMAP example from the documentation:
<mail:inbound-channel-adapter id="imapAdapter"
store-uri="imaps://[username]:[password]#imap.gmail.com/INBOX"
java-mail-properties="javaMailProperties"
channel="recieveChannel"
should-delete-messages="true"
should-mark-messages-as-read="true"
auto-startup="true">
<int:poller max-messages-per-poll="1" fixed-rate="5000"/>
</mail:inbound-channel-adapter>
POP3 and IMAP are not protocols that receive email. They go out and fetch it from a server.
The official JavaMail API
provides a platform-independent and protocol-independent framework to build mail and messaging applications.
Take a look!
Spring provides abstraction over JavaMail Api.
There are lot of examples to describe how to send mail using spring email abstraction layer.
but how can i read emails using this?
You can configure Spring to poll for emails from a POP or IMAP server
http://docs.spring.io/spring-integration/reference/html/mail.html
Or access directly.
MailReceiver receiver = new Pop3MailReceiver("pop3://usr:pwd#localhost/INBOX");
Maybe because Spring does not have a built-in support for receiving e-mails?
http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mail.html:
24. Email
24.1 Introduction
The Spring Framework provides a helpful utility library for sending email that shields the user from the specifics of the underlying mailing system and is responsible for low level resource handling on behalf of the client.
If you want to receive e-mails you must use some external libraries, including Spring Integration with POP3 support.
I have a feature in my web app like I have to send mails from the server to many email ids (some kind of notification stuff)
my web application is implemented in struts2. Possibly I have to use javamail api i guess. I am completely new to this javamail and sending mail from server. what basic steps I need to do to setup a mail server in windows, contact the server from my java web app. What api i should I use ?
The web has very limited tutorials on javamail and they are damn complicated too.
Is there any other api other than javamail by which I can send mail from my java struts2 web app.
thanks
I suggest you use Mercury for your mail server. The javamail API is pretty straightforward. Just create a utility class to simplify the javamail API further.
for this use smtp in your jsp page...
for more refrence go to www.java2s.com