On this occasion I would like to share a tutorial on how to create an application for sending email with Gmail in your application without having to open the Gmail application. This implementation uses the Java Mail API with Gmail’s SMTP settings.

I have made Components and Blocks to make implementation easier, please download them. We start the tutorial;

The first step we start by making the appearance, you can see in the picture above add 6 widgets, namely 1. Edit Text for the contents of the destination email, 2. Edit Text for the contents of the email title, 3. Edit Text for the contents of the email message, 4. Edit Text for the contents of your email , 5. EditText to fill in your email password and 6. Button to send email.


Add the JAVAMAILAPI component and name the component as you like. If you don’t have this component yet, you can download it at the link I have included at the end of this post.

Next, we enter the Logic Block implementation stage. Place the block arrangement like the image above on your Widget Button, which means that when the user clicks the Button it will make the execute command send the request to the SMTP server in my library, and then the email will be sent.

The final step of the implementation in Sketchware is to activate the four libraries as shown above, if you don’t have them, please download them from the link I included at the end of this post.

We have done all the implementation steps, then then you can RUN build your project and try to test it to send an email.

If you encounter problems that the email fails to send even though the implementation and settings are correct, then you need to give access to your application on your Google account. To do this, please visit the link here: Setting Less Secure App Access

That’s enough for the tutorial from me, if you like it, don’t forget to share it with others so that what I’ve made is useful. Thank you

JavaMailActivation Library

JavaMailAdditionnal Library

GmailSWRevo Library

GmailApi Library

JavaMail Component

JavaMail Block Implementation

%d blogger menyukai ini: