#2994·PHPMailer

sigterm when in DATA state causes QUIT to fail

Author: StevehansCreated Dec 12, 2023Updated Dec 12, 2023

Problem description

If my code is killed (e.g. with a SIGTERM), then the destructor calls smtpClose() which then calls smtp->quit().

But if data is being sent, then the quit comment is ignored, and what actually happens is that the remote end eventually times out with a 421.

I think we need a status to indicate that we are in the DATA mode, and send the DATA END before the QUIT?

Or better, we need a status to indicate that we are in data and we need to return an error to the caller, as we don't want to send a truncated email.