Receiving mail in a IntentService - android

How to check for e-mails from an IntentService on an Android device?
Is there any library?
I googled a lot for this, but i can't find the solution.

There is no system API to check for email.
Email is handled by an individual app, which can be GMail, K-9 Mail, built-in email app etc.
None of them allow to read emails programmatically, because this would be a huge security hole.
The only two things you can do is to show 'New mail' dialog in Gmail with pre-filled text and address, and force account sync, which should force GMail to check for new mail immediately: Android how to enable/disable auto sync programmatically

Found out the solution: javaee.github.io/javamail/#JavaMail_for_Android

Related

Send email in Android WITHOUT intent or GMail SMTP

So I'm either going to get crucified for this or it'll be accepted as the honest, researched question it is...
How does one go about sending an email (with an image attachment) in Android (I'm using Kotlin but I'm fine with Java) without:
Intents - I don't want the user to see anything... It must just go in the background
GMail - Every single example/piece of code/tutorial I can find always talks about using GMail's SMTP... I don't want that. I want to input my own SMTP details so the email doesn't have to come from a GMail account and look rather unprofessional.
Yeah I've tried researching but as stated above, I keep finding the easy route (GMail). I'm relatively new to Android dev (years on iOS) so if there's an API or something I'm missing, please let me know :)
Thanks
Every single example/piece of code/tutorial I can find always talks about using GMail's SMTP... I don't want that. I want to input my own SMTP details so the email doesn't have to come from a GMail account and look rather unprofessional
Have your app contact your Web service, and have the Web service send the email on your behalf.
It's technically possible for you to use JavaMail and send SMTP directly from the client. This would require you to bake SMTP server information and user credentials into the app or to be able to download them from somewhere. Either will turn your SMTP server into a source of spam and related crap, as it will be easy for people to get at that information and use it to their own ends.

Import data from an e-mail account (Android Studio)

I am creating an app for android device and I was wondering if it is possible to connect my app with an e-mail account and have notifications every time the (let's say the gmail account) receives a new mail, and display the message in a new activity. I have researched a lot but I have not found something really useful.
Can anyone give me a clue on how to do it or even where to look for?
Yes. It is possible. You have to create an email client.
Here are some good email clients
You need to use the email client API for that. Here is Gmail API, you can find more my googling.

Receive emails via broadcast receiver

I am creating an app that has only a single hard coded email address that will receive and respond to questions with the response. Only the body of the email would be necessary. It is being sent back to the app in plain text to be read, bypassing the email client picker.
My question is this: Is this even possible to do? I've searched high and low for the solution to this about 3 months now and even Google doesn't know the answer to this one.
Is it possible to receive the contents of an email message
You are certainly welcome to write your own POP3 or IMAP4 client, as you could for just about any operating system. You are also certainly welcome to see if there are any fringe email clients for Android that offer an on-device API that offers access to email messages.
Otherwise, no.
When it comes to receiving an email, it doesn't seem like anyone knows anything about how to do that.
That is because there is nothing much Android-specific about email. Email is not part of the operating system. Email is something provided by apps.

Android email ACTION_CALL equivalent

I am incorporating an email activity in my app and I'm wondering if it's possible to not have the user click the 'send button' but instead I have the mail app send the mail right away programatically.
If you would compare it to using a call intent then you could say right now I am using ACTION_DIAL but I want to use ACTION_CALL.
I have looked into this:
Sending Email in Android using JavaMail API without using the default/built-in app
But this is not meant to work with a users email account.
I'm kind of assuming it's not possible, but if anyone has any ideas, they would be most welcome.
Thanks in advance!
I'm kind of assuming it's not possible
Correct. There is no Intent action with those semantics. And, even if there were, there is no requirement that all email clients actually honor those semantics.

Android sending mail from a specific account

I have Exchange ActiveSync setup on my phone and it works as expected. My problem is that when I want to send an email in code it always uses the Gmail account (which of course I cannot remove) as the sender. It is essential that the account used be the Exchange one as that is the users business email account.
I used the code from Send auto email programmatically
It works fine but uses the Gmail account. I have set the Exchange ActiveSync account as the default but it makes no difference.
The application is used in a corporate environment only.
You can go ahead and clear defaults from Manage Apps screen in Settings. That should solve ur problem.
I had exactly the same issue in my project. There is a small bug in the referenced code.
The first line should read
emailIntent.setType("text/plain");
instead of
emailIntent.setType("plain/text");
This fixed it for me.
Hope this helps.

Categories

Resources