SmtpClient: An extension to send emails using SMTP server

After compiling in a new created app, everything is working..... emails will always be sent (in a new project) but in companion it is only working once

So it is working, finally. :grin:

Nope sry, see this:

https://issuetracker.google.com/issues/172544275?pli=1

Extension already uses activation and additional jars but not the latest version of those.So maybe that's the problem.

ChangeLog Version 1.4

  • Updated deps to avoid issues with Android 11

Aix: com.sunny.SmtpClient.aix (959.2 KB)

4 Likes

what is port in this?

That should be provided by SMTP host.
Usually for TLS it is 587 and for SSL it is 465.

Hello, sir is username and password compulsary?

Is that username and password is of gmail?

Hi @KaloTika, Welcome to the Community,

Yes.

Yes.

Thanks for replying i am from nepal so, should i use SSL or Other and is this method sercure and everytime on sending gmail we need to login everytime?

SSL and TLS both are secure.

Yes, as long as you don't share login credentials with anyone else.
You may want to obfuscate them in the app too.

No, you only have to enable less secure apps from Security Settings of your Google account.

1 Like

Hi wikki74 - have you tried vknow360's update to avoid issues with Android 11? I have but still the email does not arrive (tried several), sent from my gmail. No error messages.

So, it would be interesting to know if it now works for you.

Edit: Similar to you, if SmptClient is the only extension, it works. I find it works every time via the Companion. What I haven't figured out is:

  1. How to send an image as an attachment (this is a path issue which hopefully will be far less fraught with difficulty in the next release).
  2. Why it fails when other extensions are present.

attachment argument accepts a list of attachments and every attachment's absolute path should be provided. So developer doesn't have to worry about relative path changes such as earlier / referred to external storage but now it works as path of ASD.

At least one extension among them uses the same library as this one i.e. commons-net.

Hi Sunny. Indeed I know that, and App Inventor produces convincing absolute paths. However, it can't find those paths and that is likely to be the issue with attachments. I'm thinking that the next App Inventor update should at least have file handling and paths fixed, even if the way things are presented is still going to be confusing to the majority of Users.

What can be done about that?

Thank You, sir but still i got error of bad arguments to send please help.

I just checked the source and found that the extension doesn't declare read permission. :sweat_smile:
So you will have to additionally drag File component and tick ReadPermission property.
It is working fine if I grant read permission.

Only one extension can use the library, so other extension's developers will have to remove jar from their extensions.
There is a second method too if extension developer is not active in the community.

Still? You never showed the blocks.

I assume that remark is tongue-in-cheek :grin: What can be done on the App Inventor side to prevent 'jar clash'? Could App Inventor host the jars?

extensions are incompatible in this case...
from the App Inventor Extensions document, chapter 3.3.2 Using external libraries

In addition to your own Java code, you can also include external libraries, by following the steps in How to Add a Component. The library jar files will be included in the aix file when you package your extension

One complication here is that the external libraries (jar files) must be unique across projects. If a project imports several extensions, then two different extensions cannot import the same jar file.

Taifun

Something needs to be done about this. There are more extension developers and more extensions every week. How unique must a jar be? In name only or also in stored contents?

Can the App Inventor side prevent this issue? A registration of jars used by extensions perhaps?