Android Question Send Many Email

nickysuwandi

Member
Licensed User
Longtime User
Which problem? Make sure to use an email server that doesn't restricts the number of recipients.

how to know that mail has been success or fail so i can send another mail.

This my code

B4X:
If lvTo.Size>0 Then
                For i=0 To lvTo.Size-1
                    Dim splt() As String  = Regex.Split("\|",lvTo.GetItem(i))
                    ProgressDialogShow2("Please wait . . .Send email to " & splt(0) & "/" & splt(2) ,  True)
                    SMTP1.to.Add(splt(2))
                    SMTP1.bcc.Add(edtFrom.Text)
                    SMTP1.Subject = edtJudul.Text.Replace("[block]", splt(1) & "(" & splt(0) & ")")
                    If edtAt.Text<>"" Then
                        If File.Exists(strfolder,strfile) Then
                            SMTP1.AddAttachment(strfolder,strfile )
                        End If
                    End If
                    SMTP1.Body = edtPesan.Text.Replace("[block]", splt(1) & "(" & splt(0) & ")")
                    SMTP1.Send
                Next
            End If
 
Upvote 0

nickysuwandi

Member
Licensed User
Longtime User
MarkusR, how we know that last email has finish sent, if i send 300 message, so i can warning the user no to close the apps.

Thanks

This method help me solve my problem, maybe your guys had best way than this, please share, Thanks.

B4X:
Sub SMTP_MessageSent(Success As Boolean)
    IntMailSendCount=IntMailSendCount+1
    ProgressDialogShow2("Please wait . . .Sending Email " & IntMailSendCount & "/" & IntTotMail ,  False)
    If IntMailSendCount = IntTotMail Then
       ProgressDialogHide
       ToastMessageShow("All Email Sended",False)
    End If
End Sub
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
if u use "Wait for Event" direct after send u have a better control.
 
Upvote 0

nickysuwandi

Member
Licensed User
Longtime User
if u use "Wait for Event" direct after send u have a better control.

Thanks Markus for your advice, can you give me example..

i had try this code , when my mail send all out,still waiting appear.

B4X:
wait for (IntMailSendCount = IntTotMail)  IntMailSendCount = IntTotMail
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
Upvote 0
Top