Well, among all of send mail app, most used Intent.ACTION_SENDTO. But, Intent couldn’t send mail automatically. user need to click “ Send “ button form GMail APP. Actually, if we send mail automatically, APP is malicious to some degree. However, sometime we need function to send automatically ( secretly).
About the setting of gmail
From the setting page, we know that hostname, port and SSL is true.
Here’s what this look like in code.
Don’t forget, class need to use AsyncTask.
Well~ someday, I used those codes on Emulator again. But…I got the exception :
javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
nested exception is:
javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
The reason is … Firewall…..
After I turn off firewall at my computer, then I got the email that I send from APP.