]> granicus.if.org Git - php/commitdiff
- Adjust for improved error messages from win32/sendmail.c
authorMarkus Fischer <mfischer@php.net>
Tue, 14 May 2002 20:43:48 +0000 (20:43 +0000)
committerMarkus Fischer <mfischer@php.net>
Tue, 14 May 2002 20:43:48 +0000 (20:43 +0000)
ext/standard/mail.c

index 8b18aed1a5b177de7955772083cbc57a63ad3d58..4aae2200747690fe6741af275c6da71cbe8b04ed 100644 (file)
@@ -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;