From 8aa64bb976583a67556c1605b3749e8cdfd6da63 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Fri, 26 Dec 2025 01:21:56 +0100 Subject: [PATCH] win32/sendmail.c/SendText(): move posting of DATA prior to stripped header computation Removes some error handling and work if it fails --- win32/sendmail.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/win32/sendmail.c b/win32/sendmail.c index ea8deadeba5..f8b22897a2c 100644 --- a/win32/sendmail.c +++ b/win32/sendmail.c @@ -504,6 +504,14 @@ static int SendText(char *RPath, const char *Subject, const char *mailTo, const efree(tempMailTo); } + if (!Post("DATA\r\n")) { + return (FAILED_TO_SEND); + } + if ((res = Ack(&server_response)) != SUCCESS) { + SMTP_ERROR_RESPONSE(server_response); + return (res); + } + /* Send mail to all Bcc rcpt's This is basically a rip of the Cc code above. Just don't forget to remove the Bcc: from the header afterwards. */ @@ -578,20 +586,6 @@ static int SendText(char *RPath, const char *Subject, const char *mailTo, const } } - if (!Post("DATA\r\n")) { - if (stripped_header) { - efree(stripped_header); - } - return (FAILED_TO_SEND); - } - if ((res = Ack(&server_response)) != SUCCESS) { - SMTP_ERROR_RESPONSE(server_response); - if (stripped_header) { - efree(stripped_header); - } - return (res); - } - /* send message header */ if (Subject == NULL) { res = PostHeader(RPath, "No Subject", mailTo, stripped_header);