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.
Related
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.
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
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.
i looking for code to send an email from my android application. I have googled and read that the code that are given will not run on emulators. i will have to put the code on actual devices to send an email.
why is this so?
thank you in advance
This migh be helpful Android Email Intent
If you are using an emulator, you’ll
need to configure the email client. If
the email client is not configured, it
will not respond to the Intent we’ll
be discussing. If you want to see the
chooser in action, you’ll need to
configure a device using multiple
messaging applications, such as the
Gmail application and the Email
application.
But using a phone might be way better and easy for sure.
As the previous answers said, the emulator doesn't include any email application for security purposes. Nonetheless you can download one (k9mail, for example) and it will work without issues whatsoever.
Because the emulator does not have an email app. You'll have to install one.
Because emulator is our virtual device is use only for testing purpose.
and reason is emulator is not a valid IP address due to security purpose it is not send email by emulator.
I was wondering how to get the email from the owner of the phone or from the gmail account used on the phone.
I am trying to do this on android 1.6 and up.
I know its possible because I have seen some apps that get the email.
Maybe its undocumented or it reads it from a undocumented provider or some authentication service, but I know its possible.
Can anybody help me on this?
Thanks
Daniel
To retrieve information from another application you would use it's content provider.
The problem with what you want to do is that the gmail application is closed source and does not have documentation like the rest of the open source SDK. You could hack a solution together using undocumented providers like you said, but updates to the gmail application may break your code.
Either create your own email application using POP3 or IMAP and integrate with that, or think of a different way to do what you're looking to accomplish.