Skip to content

Commit 4431aa9

Browse files
committed
win32/sendmail.c: remove mailCc parameter that is always NULL
1 parent 0e19bc1 commit 4431aa9

File tree

3 files changed

+7
-30
lines changed

3 files changed

+7
-30
lines changed

ext/standard/mail.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c
543543
char *tsm_errmsg = NULL;
544544

545545
/* handle old style win smtp sending */
546-
if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, hdr, subject, to, message, NULL) == FAILURE) {
546+
if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, hdr, subject, to, message) == FAILURE) {
547547
if (tsm_errmsg) {
548548
php_error_docref(NULL, E_WARNING, "%s", tsm_errmsg);
549549
efree(tsm_errmsg);

win32/sendmail.c

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static const char *ErrorMessages[] =
111111
#define PHP_WIN32_MAIL_DOT_PATTERN "\n."
112112
#define PHP_WIN32_MAIL_DOT_REPLACE "\n.."
113113

114-
static int SendText(char *RPath, const char *Subject, const char *mailTo, char *mailCc, const char *data,
114+
static int SendText(char *RPath, const char *Subject, const char *mailTo, const char *data,
115115
const char *headers, char *headers_lc, char **error_message);
116116
static int MailConnect();
117117
static int PostHeader(char *RPath, const char *Subject, const char *mailTo, char *xheaders);
@@ -185,8 +185,7 @@ static zend_string *php_win32_mail_trim_header(const char *header)
185185
// See SendText() for additional args!
186186
//*********************************************************************
187187
PHPAPI int TSendMail(const char *host, int *error, char **error_message,
188-
const char *headers, const char *Subject, const char *mailTo, const char *data,
189-
char *mailCc)
188+
const char *headers, const char *Subject, const char *mailTo, const char *data)
190189
{
191190
int ret;
192191
char *RPath = NULL;
@@ -279,7 +278,7 @@ PHPAPI int TSendMail(const char *host, int *error, char **error_message,
279278
PW32G(mail_host), !INI_INT("smtp_port") ? 25 : INI_INT("smtp_port"));
280279
return FAILURE;
281280
} else {
282-
ret = SendText(RPath, Subject, mailTo, mailCc, data, headers ? ZSTR_VAL(headers_trim) : NULL, headers ? ZSTR_VAL(headers_lc) : NULL, error_message);
281+
ret = SendText(RPath, Subject, mailTo, data, headers ? ZSTR_VAL(headers_trim) : NULL, headers ? ZSTR_VAL(headers_lc) : NULL, error_message);
283282
TSMClose();
284283
if (RPath) {
285284
efree(RPath);
@@ -387,7 +386,7 @@ static char *find_address(char *list, char **state)
387386
// Author/Date: jcar 20/9/96
388387
// History:
389388
//*********************************************************************
390-
static int SendText(char *RPath, const char *Subject, const char *mailTo, char *mailCc, const char *data,
389+
static int SendText(char *RPath, const char *Subject, const char *mailTo, const char *data,
391390
const char *headers, char *headers_lc, char **error_message)
392391
{
393392
int res;
@@ -464,29 +463,8 @@ static int SendText(char *RPath, const char *Subject, const char *mailTo, char *
464463
}
465464
efree(tempMailTo);
466465

467-
if (mailCc && *mailCc) {
468-
tempMailTo = estrdup(mailCc);
469-
/* Send mail to all rcpt's */
470-
token = find_address(tempMailTo, &token_state);
471-
while (token != NULL)
472-
{
473-
SMTP_SKIP_SPACE(token);
474-
FormatEmailAddress(PW32G(mail_buffer), token, "RCPT TO:<%s>\r\n");
475-
if (!Post(PW32G(mail_buffer))) {
476-
efree(tempMailTo);
477-
return (FAILED_TO_SEND);
478-
}
479-
if ((res = Ack(&server_response)) != SUCCESS) {
480-
SMTP_ERROR_RESPONSE(server_response);
481-
efree(tempMailTo);
482-
return (res);
483-
}
484-
token = find_address(NULL, &token_state);
485-
}
486-
efree(tempMailTo);
487-
}
488466
/* Send mail to all Cc rcpt's */
489-
else if (headers && (pos1 = strstr(headers_lc, "cc:")) && ((pos1 == headers_lc) || (*(pos1-1) == '\n'))) {
467+
if (headers && (pos1 = strstr(headers_lc, "cc:")) && ((pos1 == headers_lc) || (*(pos1-1) == '\n'))) {
490468
/* Real offset is memaddress from the original headers + difference of
491469
* string found in the lowercase headers + 3 characters to jump over
492470
* the cc: */

win32/sendmail.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333

3434

3535
PHPAPI int TSendMail(const char *host, int *error, char **error_message,
36-
const char *headers, const char *Subject, const char *mailTo, const char *data,
37-
char *mailCc);
36+
const char *headers, const char *Subject, const char *mailTo, const char *data);
3837
PHPAPI void TSMClose(void);
3938
PHPAPI const char *GetSMErrorText(int index);
4039
#endif /* sendmail_h */

0 commit comments

Comments
 (0)