AbortMail()

Just starting out? Need help? Post your questions and find answers here.
wayne-c
Enthusiast
Enthusiast
Posts: 337
Joined: Tue Jun 08, 2004 10:29 am
Location: Zurich, Switzerland

AbortMail()

Post by wayne-c »

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()?

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
Or why not a Timeout parameter directly in the SendMail()-Function?
As you walk on by, Will you call my name? Or will you walk away?
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: AbortMail()

Post by jassing »

FreeMail() won't end it?
wayne-c
Enthusiast
Enthusiast
Posts: 337
Joined: Tue Jun 08, 2004 10:29 am
Location: Zurich, Switzerland

Re: AbortMail()

Post by wayne-c »

Well it might do it, but I am not sure - should be confirmed by @Fred. I'd prefer a real AbortMail() function that then gives #PB_Mail_Aborted as return value of MailProgress()
As you walk on by, Will you call my name? Or will you walk away?
infratec
Always Here
Always Here
Posts: 7622
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: AbortMail()

Post by infratec »

There should be send a RSET command maybe followed bye a QUIT.
I don't think that FreeMail() does this.

If you really need this ... libcurl.
wayne-c
Enthusiast
Enthusiast
Posts: 337
Joined: Tue Jun 08, 2004 10:29 am
Location: Zurich, Switzerland

Re: AbortMail()

Post by wayne-c »

infratec wrote: Sun Apr 30, 2023 4:34 pm There should be send a RSET command maybe followed bye a QUIT.
I don't think that FreeMail() does this.

If you really need this ... libcurl.
We move this to Features and Requests?
As you walk on by, Will you call my name? Or will you walk away?
User avatar
idle
Always Here
Always Here
Posts: 5915
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: AbortMail()

Post by idle »

Would be a good to add, but it mightn't be necessary as the rfc says
There are circumstances, contrary to the intent of this
specification, in which an SMTP server may receive an indication that
the underlying TCP connection has been closed or reset. To preserve
the robustness of the mail system, SMTP servers SHOULD be prepared
for this condition and SHOULD treat it as if a QUIT had been received
before the connection disappeared.

https://www.rfc-editor.org/rfc/rfc5321. ... on-4.1.1.5
Post Reply