From 9b86cff931f14389117b7165fb83c854036d60ef Mon Sep 17 00:00:00 2001 From: Markus Fischer Date: Tue, 14 May 2002 20:43:48 +0000 Subject: [PATCH] - Adjust for improved error messages from win32/sendmail.c --- ext/standard/mail.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 8b18aed1a5..4aae220074 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -112,6 +112,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char { #ifdef PHP_WIN32 int tsm_err; + char *tsm_errmsg = NULL; #endif FILE *sendmail; int ret; @@ -121,8 +122,13 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char if (!sendmail_path) { #ifdef PHP_WIN32 /* handle old style win smtp sending */ - if (TSendMail(INI_STR("SMTP"), &tsm_err, headers, subject, to, message) != SUCCESS){ - php_error(E_WARNING, "%s() %s", get_active_function_name(TSRMLS_C), GetSMErrorText(tsm_err)); + if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, headers, subject, to, message) == FAILURE) { + if (tsm_errmsg) { + php_error(E_WARNING, "%s() %s", get_active_function_name(TSRMLS_C), tsm_errmsg); + efree(tsm_errmsg); + } else { + php_error(E_WARNING, "%s() %s", get_active_function_name(TSRMLS_C), GetSMErrorText(tsm_err)); + } return 0; } return 1; -- 2.40.0