Commit 8aa64bb9765 for php.net
commit 8aa64bb976583a67556c1605b3749e8cdfd6da63
Author: Gina Peter Banyard <girgias@php.net>
Date: Fri Dec 26 01:21:56 2025 +0100
win32/sendmail.c/SendText(): move posting of DATA prior to stripped header computation
Removes some error handling and work if it fails
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);