B4J Question problem when sending an email after I make a standalone package

Hello, I have the following problem when sending an email: when I run the code in the IDE it works normally and sends an email, but when I compile it - it doesn't work. Please help.
B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI
    Private Button1 As B4XView
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
End Sub

Sub Button1_Click
    xui.MsgboxAsync("sending email!", "backup_PC-NOV2025")
    
    SendMail("backup_PC-NOV2025_20251110.sql","danchovasilev@abv.bg")

End Sub

Sub SendMail(mfIme As String, emailDo As String)

    Dim smtp As SMTP
    
    smtp.Initialize("mail.300lista.website", 465, "danchovasilev@300lista.website", "pass", "mail")
    smtp.UseSSL = True
    smtp.To.Add(emailDo)
    smtp.Subject = "backup copy of  - " & mfIme
    smtp.Sender.Replace(smtp.Sender, "АРХИВ")
    smtp.HtmlBody = True
    Dim tmpStR As String = "/ " & GetEnvironmentVariable("COMPUTERNAME", "??") & " /</b><br>Hi,"
    smtp.Body = tmpStR & $"</b><br>
    The latest database backup is attached.<br>
    Regards,<br>
    Automatic system<br>
    <br><br><br>
    ___"$
    smtp.AddAttachment(File.DirApp,mfIme)
    smtp.Send

    Sleep(100000)

End Sub
 
Solution
In such circumstances it is suggested to run the run_debug.bat file included in the standalone package which should display the error causing the application not to run.

However I note your application uses SSL and referring to Integrated B4JPackager11 - The simple way to distribute standalone UI apps , Tip 7. says If you get an error that looks like: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure, add:
B4X:
#PackagerProperty: IncludedModules = jdk.crypto.ec

and so that may be the solution, particularly if when you run run_debug.bat you see the above error.

bdunkleysmith

Active Member
Licensed User
Longtime User
In such circumstances it is suggested to run the run_debug.bat file included in the standalone package which should display the error causing the application not to run.

However I note your application uses SSL and referring to Integrated B4JPackager11 - The simple way to distribute standalone UI apps , Tip 7. says If you get an error that looks like: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure, add:
B4X:
#PackagerProperty: IncludedModules = jdk.crypto.ec

and so that may be the solution, particularly if when you run run_debug.bat you see the above error.
 
Upvote 2
Solution

DonManfred

Expert
Licensed User
Longtime User
Use the run_debug.bat to start the app and check for any errors in the output.
 
Upvote 0
In such circumstances it is suggested to run the run_debug.bat file included in the standalone package which should display the error causing the application not to run.

However I note your application uses SSL and referring to Integrated B4JPackager11 - The simple way to distribute standalone UI apps , Tip 7. says If you get an error that looks like: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure, add:
B4X:
#PackagerProperty: IncludedModules = jdk.crypto.ec

and so that may be the solution, particularly if when you run run_debug.bat you see the above error.
Thank you very much for the quick and correct answer. This solved my problem and will surely help other users.
 
Upvote 0
Top