0

As a beginner in android, I am developing a Tasks manager app.

There is an option in the app, where the app can send the user a reminder by email on the date and time he wants, is there any way to do it?

The email's body will contain the Task's title and other info about it.

ak_ourb
  • 1
  • 1
  • I believe that is a task for a backend mail server to do. Your app shouldn't handle that logic. Instead you should have a server where you can save your reminder data and program it to send an email on the date and time. – Mateo Hervas Jul 12 '20 at 16:00
  • I am saving the reminder data in Firebase. But how can I program it to send the email on a specific date and time? That's exactly the problem I am facing. – ak_ourb Jul 12 '20 at 16:11
  • Since you using firebase why don't you try the Cloud Scheduler you basically need something similar to a cron job or task scheduler. Also https://developer.android.com/reference/android/app/job/JobScheduler Android has JobScheduler class but i would not recommend having your app trigger the task. – DarkVision Jul 12 '20 at 16:21

1 Answers1

0

You can use the Java Mail API: Here is an example for sending an email with GMail.
https://stackoverflow.com/a/47452/13912132

You will need the JAR-Files (Website: https://javaee.github.io/javamail/)
Or with maven:

<dependencies>
 <dependency>
  <groupId>com.sun.mail</groupId>
  <artifactId>javax.mail</artifactId>
  <version>1.6.2</version>
  </dependency>
</dependencies>
JCWasmx86
  • 3,473
  • 2
  • 11
  • 29