danchovasilev
Member
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