Android Question Sending an email

As the application runs, I send an email.

B4X:
email.To.Add(emailAddress)
email.Subject = "Program crashed"
email.Body = sBody
StartActivity(email.GetIntent)

I need to wait for the email sending process to complete before my application can continue.
How can I tell if an email has already been sent?

Thank you in advance.
 

drgottjr

Expert
Licensed User
Longtime User
there is nothing to "wait for". she is not coming back, my friend šŸ˜ž

to do what you want the way you're sending an email, you need StartActivityForResult and
an email client that returns a result. StartActivity does not do that, and it's unclear if your
email client knows how to return a result to somebody that is waiting. i hope your understand
this.

if you have access to an smtp server, you can use the Net library to send email from within
your app. that library tells you if your email was successfully sent. then you can continue.
by the way, successfully sent does not mean received by the recipient. it just means the
recipient's mail server reports no errors. the recipient's server and/or the recipient could have
spam filters in place. there would be no error if the mail were quietly deleted.

try the Net library
https://www.b4x.com/android/forum/threads/new-net-library-android-ftp-smtp-and-pop3.10892/#content
 
Upvote 0
there is nothing to "wait for". she is not coming back, my friend šŸ˜ž

to do what you want the way you're sending an email, you need StartActivityForResult and
an email client that returns a result. StartActivity does not do that, and it's unclear if your
email client knows how to return a result to somebody that is waiting. i hope your understand
this.

if you have access to an smtp server, you can use the Net library to send email from within
your app. that library tells you if your email was successfully sent. then you can continue.
by the way, successfully sent does not mean received by the recipient. it just means the
recipient's mail server reports no errors. the recipient's server and/or the recipient could have
spam filters in place. there would be no error if the mail were quietly deleted.

try the Net library
https://www.b4x.com/android/forum/threads/new-net-library-android-ftp-smtp-and-pop3.10892/#content
Thank you very much. I've been working in B4A not so long ago and I don't know everything.
 
Upvote 0
Top