-1

I need to send an email when clicking on a button without using gmail clients. For this I am using the java mail api, and I am basing myself on the code of the following references:

https://netcorecloud.com/tutorials/send-email-in-android-using-javamail-api/?fbclid=IwAR0hiFPFrpajzldPB-MhnY-FI6n11aRaiY1_2sFCniHQhHvUa7BiAI8HON8

Sending Email in Android using JavaMail API without using the default/built-in app

I have tried placing some logs to print/debug things and I realized that the last part of the code is not executed Transport.send(message);

  • Post the actual code you're using here, not a link to a tutorial. In general though- what do you actually want to do? Send an email as the owner of the phone? That's pretty much not going to happen unless the user gives you their password to their email, and asking for that smells of malware. Send one as your app? You'd need an SMTP server and the password to that would be in your app, a bad idea- sending email as yourself should always happen from a server. – Gabe Sechan Sep 13 '22 at 20:04
  • I'm sorry about the reference and lack of code. What I want to achieve is to make an app which has a button, then when clicking on said button an email must be sent to a particular user (from the same app), All this, as I already mentioned, using the java mail api. According to what you answer, it is not enough to use the api, I also have to configure an SMPT, am I correct with that? If so, could you guide me a bit on how to do this, since I I was just applying the java mail api – mauricio romero Sep 13 '22 at 20:11
  • You're honestly better off doing this from your server- client side shouldn't be sending email (unless its trying to send an email from the phone's owner, in which case launching their email app is the correct way to do it). In modern email architectures you'd likely be rejected because you aren't a registered SMTP host. These days email servers don't tend to allow random connections from random IPs. Server side I'd assume you'd own the SMTP server (or at least the email account you're sending from) so you can set it up to work correctly. Hard to do that from the front end. – Gabe Sechan Sep 13 '22 at 20:46

1 Answers1

0

sorry for my english, but your problem is probably that you didn't generate the password for the app, from May 30, 2022 the less security option was discontinued by google now you have to follow this step by step https://support.google.com/accounts/answer/185833
in the end it will be generated a 16-digit password, just put it in place of your current password

Maklan
  • 1