Skip to content

Commit 8f58f05

Browse files
committed
Fix sendmail on WIN
1 parent f07d66c commit 8f58f05

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

win32/sendmail.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static char *ErrorMessages[] =
122122
* Returns NULL on error, or the new char* buffer on success.
123123
* You have to take care and efree() the buffer on your own.
124124
*/
125-
static zend_string *php_win32_mail_trim_header(char *header)
125+
static zend_string *php_win32_mail_trim_header(const char *header)
126126
{
127127
zend_string *result, *result2;
128128
zend_string *replace;
@@ -177,13 +177,13 @@ static zend_string *php_win32_mail_trim_header(char *header)
177177
// See SendText() for additional args!
178178
//********************************************************************/
179179
PHPAPI int TSendMail(const char *host, int *error, char **error_message,
180-
char *headers, const char *Subject, const char *mailTo, const char *data,
180+
const char *headers, const char *Subject, const char *mailTo, const char *data,
181181
char *mailCc, char *mailBcc, char *mailRPath)
182182
{
183183
int ret;
184184
char *RPath = NULL;
185185
zend_string *headers_lc = NULL, *headers_trim = NULL; /* headers_lc is only created if we've a header at all */
186-
char *pos1 = NULL, *pos2 = NULL;
186+
const char *pos1 = NULL, *pos2 = NULL;
187187

188188
if (host == NULL) {
189189
*error = BAD_MAIL_HOST;
@@ -216,7 +216,7 @@ PHPAPI int TSendMail(const char *host, int *error, char **error_message,
216216
RPath = estrdup(INI_STR("sendmail_from"));
217217
} else if (headers_lc) {
218218
int found = 0;
219-
char *lookup = ZSTR_VAL(headers_lc);
219+
const char *lookup = ZSTR_VAL(headers_lc);
220220

221221
while (lookup) {
222222
pos1 = strstr(lookup, "from:");
@@ -353,11 +353,12 @@ PHPAPI char *GetSMErrorText(int index)
353353
// History:
354354
//*******************************************************************/
355355
static int SendText(char *RPath, const char *Subject, const char *mailTo, char *mailCc, char *mailBcc, const char *data,
356-
char *headers, char *headers_lc, char **error_message)
356+
const char *headers, char *headers_lc, char **error_message)
357357
{
358358
int res;
359359
char *p;
360-
char *tempMailTo, *token, *pos1, *pos2;
360+
char *tempMailTo, *token;
361+
const char *pos1, *pos2;
361362
char *server_response = NULL;
362363
char *stripped_header = NULL;
363364
zend_string *data_cln;

win32/sendmail.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
#define MAX_ERROR_INDEX 22 /* Always last error message + 1 */
3333

3434

35-
PHPAPI int TSendMail(const char *smtpaddr, int *returnerror, char **error_message,
36-
char *RPath, const char *Subject, const char *mailTo, const char *data,
35+
PHPAPI int TSendMail(const char *host, int *error, char **error_message,
36+
const char *headers, const char *Subject, const char *mailTo, const char *data,
3737
char *mailCc, char *mailBcc, char *mailRPath);
3838
PHPAPI void TSMClose(void);
3939
static int SendText(char *RPath, const char *Subject, const char *mailTo, char *mailCc, char *mailBcc, const char *data,
40-
char *headers, char *headers_lc, char **error_message);
40+
const char *headers, char *headers_lc, char **error_message);
4141
PHPAPI char *GetSMErrorText(int index);
4242

4343
static int MailConnect();

0 commit comments

Comments
 (0)