SmtpClient: An extension to send emails using SMTP server

How to avoid runtime errors with the companion app

  1. After importing an extension, please restart the companion app.
  2. If you like to use an extension on a different screen, in Screen1 additionally drag the extension into the working area.

While starting the companion app, all necessary assets and also the imported extensions of your project will be copied to your device. So in case the no such class error shows up, the extension code to run the extension is not available on your device. Without that code the companion app is not able to execute methods from the extension.

In case restarting the companion app does not work for you after trying several times, then as it looks like the only way for you to test you app will be after building it using the apk file.

Taifun

1 Like

Thank you for your help.

Sadly it didnt work with the companion app :confused:

I restarted the app multiple times and added the extension in screen1 aswell.

Building the apk file and installing on the phone worked however. Is there any other solution so i dont have to install the apk file everytime i will test the app?

(Sorry if my english is not perfect. Definitely not a native speaker here)

Tanks again

Try to connect wireless
Taifun

1 Like

Hi, @vknow360

When trying to send contents with Chinese.

I send successfully, but I got this:

the subject is good, but the body became ????

Can you advise how to avoid this?
Thanks.

What happens when you encode the Chinese characters using the Web. UriEncode block, then passing it to the extension?

tested,

got this:
image

You have to use Encode block but you used Decode block. Please try encoding content.

Sorry my bad.

Still not working, both Encode and Decode

Here is a small update.
com.sunny.SmtpClient.aix (959.4 KB)

You needn't encode content now.

1 Like

i created app passwords..and secure the activity..btw what's the problem??

edit: Solved

How can we send this kind of email(body) though this extension??

feed the body socket with HTML text, and isHTML is true.

How to write the HTML? Just google it, there are a lot of tutorials.

3 Likes

Hi the code is working great without the image but with an attachment it gives me error "IOException while sending message".
Could somebody help?
Pls reply ASAP if possible as I have a school project deadline with 2hrs.

Show your relevant blocks

I assume this is what u want?
the code works like this however when i use an attachment i get the error"IOException while sending message"(sending code with attachment shortly)

Im using Camera instead of Image Picker


showing as label5 might be important


the code with the attachment

attachment is expecting a file, not a string.

If you want to include the contents of your label, add it to the body of your email message.

setting Label5 to image in the AfterPicture event should give you the filepath to the image.

do u mean the do it result?

im getting Do It Result: "file:///storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/Pictures/app_inventor_1682348329907.jpg"

what should i do with this?
since the file will be diffrent everytime will u not need to input the do it differently?
im new so im asking