AbortMail()
Posted: Sun Apr 30, 2023 11:17 am
Howdy
I am sending asynchronous mail and want to timeout after 15s - how to abort the operation? There is AbortFTPFile() and AbortHTTP() but no AbortMail()?
Or why not a Timeout parameter directly in the SendMail()-Function?
I am sending asynchronous mail and want to timeout after 15s - how to abort the operation? There is AbortFTPFile() and AbortHTTP() but no AbortMail()?
Code: Select all
Timeout = ElapsedMilliseconds() + 15000
Result = SendMail(0, "smtp.free.fr", 25, #PB_Mail_Asynchronous)
Repeat
Progress = MailProgress(0)
Delay(300)
If ElapsedMilliseconds() > Timeout
AbortMail(0) ; <-- Does not exist?!
Break
EndIf
Until Progress = #PB_Mail_Finished Or Progress = #PB_Mail_Error
If Progress = #PB_Mail_Finished
MessageRequester("Information", "Mail correctly sent !")
Else
MessageRequester("Error", "Can't sent the mail !")
EndIf