How to Send an Email via JavaMail API - Android Studio Tutorial

preview_player
Показать описание
Today, I’m going to show you how to send email from android app using java mail API. Watch to learn how it work and don’t forget to turn on your notifications!

First you need to create app password for send email from app.Follow the instructions.
Create & use App Passwords
Note: If you use 2-Step-Verification and are seeing a "password incorrect" error when trying to access your Google Account, an App Password may solve the problem.

Go to your Google Account.
On the left navigation panel, choose Security.
On the "Signing in to Google" panel, choose App Passwords. If you don’t see this option:
2-Step Verification is not set up for your account.
2-Step Verification is set up for security keys only.
Your account is through work, school, or other organization.
You’ve turned on Advanced Protection for your account.
At the bottom, choose Select app and choose the app you’re using.
Choose Select device and choose the device you’re using.
Choose Generate.
Follow the instructions to enter the App Password. The App Password is the 16-character code in the yellow bar on your device.
Choose Done.

Now Use this password for APP

Most of the time, you’ll only have to enter an App Password once per app or device, so don’t worry about memorizing it.

*FOLLOW ME ON SOCIAL MEDIA! *

Have any other questions about this video? Let me know in the comments!

#AndroidStudio
#JavaMailAPI
Рекомендации по теме
Комментарии
Автор

For those encountering errors. One way to solve this would be to enable less secure access in your google account. This is very easy to do just look it up online. nothing needs to be altered to your code. once less secure access is enabled then try to send your email again and see if it works

vxt
Автор

Thanks, I was finding a way to implement gmail API on sdk api level lower than 23 and suddenly found this. It makes things so much easier

Suku
Автор

Great tutorial. Thanks!! The message is editable with HTML format ?

germanaroccasalas
Автор

Thanks a ton! It is what I was looking for

hussnainmehdi
Автор

Thank you so much man, it worked perfectly!

Halford
Автор

Hey brother! It works well! The problem is that Google gives me a warning through Gmail that someone tries to access your account, but it can work.

leandrocorrea
Автор

Your tutorial is awesome , it is working fine for me
but how can i send this mail with text that will be send(with design--like bold texts and line separators(while using line seperators it is going into hided quotes))

Thank you in advance

pabbineedirahul
Автор

It is a great video, thank you very much!! It works very well

danielliu
Автор

Thanks a ton! It is what I was looking for 👏👋

guliyevshahriyar
Автор

Man, Thank you! I've seen a few tutorials about this, but none worked for me properly, yours work like a charm(see P.S for solution for some problems). keep this video up and keep creating videos man!

P.S You should add the enable less secure and enable access captcha options, to avoid some security errors you might encounter.

lidory
Автор

is there away to get an event or some how to know when the email has been sent so I can for example close the page when it's sent?

lidory
Автор

Hello, May I know if I don't want enable less secure access for my account then is it possible for making it work by changing the code? Thank you.

keikai
Автор

is that save putting your email information and password inside the app..., how about someone trying to decompile your software and found your credentials?

ogibinedi
Автор

Thank you its works, 2024 hehehehehehe i use yahoo to send my email.

wenwengaming
Автор

hello, I have a question, only work with google mail?

matiasdiaz
Автор

Can we add attachment from SD card into this code

prateekshrivastava
Автор

hei bro, my app has already done what your app did at 9:03
but I don't get the email? can you help me?

anomolisagag
Автор

Great work! But one question, does it only work with gmail? What about other app like outlook? Thank you!

samstoyroom
Автор

How can I also send picture attachments?

MyBestDayy
Автор

This only works for me if I'm connected to a mobile network or however you call those. But it doesn't work when I'm connected to a private home wifi. Do you know why this is the case? Please don't ignore my comment.

whoever
visit shbcf.ru