Thu Nov 29 20:02:44 PST 2018


Image



We know, We can send an e-mail using Intents, This will invoke either default mail app or built-in device mail apps to send an e-mail. This is unnecessary for user to work on e-mail application while he is trying to work an our application. So the question is


how to send an e-mail from android application without user interaction?

Answer is you can achieve this using
JavaMail API.

You have to use following three jars.
mail.jar
activation.jar
additionnal.jar Complete code:




MainActivity.java



package com.exmple.javamail; import android.app.Activity; import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import java.io.UnsupportedEncodingException; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; i?



Comments

Popular posts from this blog

termux vnc viewer setup

../Settings.jpg

me.html