obtain a callbacks of sending mail - android

I am developing an application that needs to send inside an ordinary email.
The mail must be sent with the account set up on your smartphone. Through Intent.ACTION_SEND sending the mail goes smoothly.
Is there a way to know if the email was sent and if the sending has been successful?

The mail must be sent with the account set up on your smartphone
You assume the existence of such an account, and this is not a valid assumption. Bear in mind that just because they may have a Google account (e.g., for use with the Play Store), they may not be using Gmail, and there is nothing forcing users to use their Android device for any other email.
Is there a way to know if the email was sent and if the sending has been successful?
No.
ACTION_SEND does not send email. ACTION_SEND lets the user share content of a specified MIME type. Whether the user chooses to send via email, who they send the email to, whether they change the content, whether they send the email at all, and so forth is up to the user, and your app is not informed of any of this.

Related

send an email with content that can not be edited

I make an application that allows users to send an email. when i use the usual procedure to send an email with intents the user is redirected to gmail app, and he can edit the mail. I would like to prevent the user from modifying the content of the email. would anyone know how to do it please?
This is too long for a comment, so I am posting the answer. The short answer is that if you rely on the user's phone as the email client, then there is no guaranteed way to prevent the user from editing the email message, because the Gmail app is out of your control. So, what you should instead do here is to use a server side webapp to send the message instead. As an example, I have used an email service (e.g. HawkHost) on the server side behind an Android app to send the message. With this setup, you can completely control what message gets sent from the user or on behalf of the user.

Tracking if email was sent in another app

I am developing an app where the user can share via email (GMail app) or sms. Both methods will launch an external app that will do the work.
Since I am implementing tracking analytics that will be triggered when the email/SMS is sent, my question is how to send back or detect the status of sent email from GMail to my app. I know that it may sound like a stupid question, but I was wondering if this is possible.
how to send back or detect the status of sent email from gmail to my app
There is no requirement for the user to send the email, let alone for any email app (Gmail or otherwise) to let you know if the email was sent.
If the email is being processed automatically on some server, the server could use GCM or similar techniques to send a message to the device and your app indicating that the email was received.

Is this possible to get notification for all emails that arrive on an Android phone?

Is this possible to somehow get notified whenever an email, for any email address, arrives on an Android phone (whether this account is using the default email application or any other email client)?
I am using the Java mail API.
Most probably you'll have to define a BroadcastReceiver listening for incoming emails.
Now, you should focus your investigation on discovering what Intent is fired when a new email arrives.
Note that this may be specific per application, and other mail clients may not send any Intents at all.

Sending e-mail without sender's mailbox

In my application I send e-mail using mail.javax. In this case, I have two e-mail address of the sender and recipient. I would like to send e-mail directly to the recipient. without using the sender's mailbox. Is there a way?
Just go ahead and specify spambot or whatever else.
But be aware that most likely your mail will be either blocked by your provider SMTP or by users mail server.

How can I check if emails can be sent from my phone?

I have an app that will send an email from the server if the app user does not have their email set up on their phone. Otherwise it will be sent through the android device.
What methods are there to check if email is configured on the phone?
Thanks
Another way to let the user to decide to send the email is to just create and use an Email Intent. That way the user sees that you want to send an email, and can choose what email client sends the email.
Example:
startActivity(new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:to#gmail.com"));

Categories

Resources