[Gambas-user] ProgressBar and Smtp control

Benoît Minisini gambas at ...1...
Fri Aug 5 00:27:06 CEST 2011


>  >but this time depend of the server, no ?
> 
> (a) this code don't works good, progress bar move all to the end of the
> process:
> 
> private errore as integer
> private endprocess as boolean
> 
> public sub SendMail()
> Dim n As Integer
> Dim x As Integer
> 
> If txtTitle.text = "" Or EDITOR_MAIL.TextEdit1.RichText = "" Then
>    errore = 1
>    Message("Impossible to send data, data not complete")
> Else
>     SmtpClient1.To.Add(toemail.text)
>     SmtpClient1.Subject = txtTitle.text
>     SmtpClient1.Add(EDITOR_MAIL.TextEdit1.RichText, "text/html")
>     Timer1.Enabled = True
>     ProgressBar1.Value = 0
>     endprocess = False
>     SmtpClient1.Send
>     endprocess = True
>     Message("Email sent.")
> Endif
> End
> 
> Public Sub Timer1_Timer()
> ProgressBar1.Value = ProgressBar1.Value + 0.05
> If endprocess=true Then
> Timer1.Enabled = False
> End If
> End
> 
> (b) I must have the possibility to send these mime types:
> Libre Office (Calc, Write, Impress)
> Office (Excel, Word, Powerpoint)
> Acrobat (Pdf)
> Images and video
> Can me explein the right code to add these file to the mail?
> 
> Thx
> 
> Andrea Bertini
> 

The gb.net.smtp is not asynchronous at all. In other words, sending a mail 
will block the event loop.

-- 
Benoît Minisini




More information about the User mailing list