From: Frank M. Kromann Date: Tue, 2 Jul 2002 19:29:15 +0000 (+0000) Subject: Switch from imap_sendmail.* to sendmail.c under Win32 X-Git-Tag: xmlrpc_epi_0_51_merge_pt~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=407a0ec66ade7b13b306e0f9ce60d571c9206a21;p=php Switch from imap_sendmail.* to sendmail.c under Win32 --- diff --git a/ext/imap/imap.dsp b/ext/imap/imap.dsp index ea79f3b445..08cc00e551 100644 --- a/ext/imap/imap.dsp +++ b/ext/imap/imap.dsp @@ -123,7 +123,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "ZTS" /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /D HAVE_IMAP2001=1 /FR /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\imap\c-client" /D "ZTS" /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /D HAVE_IMAP2001=1 /FR /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x40d /d "NDEBUG" @@ -133,7 +133,8 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib wsock32.lib winmm.lib cclient.lib Secur32.lib CertIdl.Lib /nologo /dll /machine:I386 /nodefaultlib:"LIBCMT" /out:"..\..\Release_TS/php_imap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib wsock32.lib winmm.lib cclient.lib Secur32.lib CertIdl.Lib /nologo /dll /machine:I386 /nodefaultlib:"LIBCMT" /out:"..\..\Release_TS/php_imap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\imap" +# SUBTRACT LINK32 /nodefaultlib !ENDIF @@ -148,10 +149,6 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=..\..\win32\imap_sendmail.c -# End Source File -# Begin Source File - SOURCE=.\php_imap.c # End Source File # Begin Source File @@ -164,10 +161,6 @@ SOURCE=..\..\win32\sendmail.c # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File -SOURCE=..\..\win32\imap_sendmail.h -# End Source File -# Begin Source File - SOURCE=.\php_imap.h # End Source File # Begin Source File diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 17a968746e..aab668654a 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -51,8 +51,9 @@ #include #ifdef PHP_WIN32 -#include "winsock.h" -#include "win32/imap_sendmail.h" +#include +#include +#include "win32/sendmail.h" MAILSTREAM DEFAULTPROTO; #endif @@ -3251,10 +3252,54 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char * #endif #ifdef PHP_WIN32 - if (imap_TSendMail(INI_STR("SMTP"), &tsm_err, headers, subject, to, message, cc, bcc, rpath) != SUCCESS) { + char *tempMailTo; + ADDRESS *addr; + char *bufferCc = NULL, *bufferBcc = NULL; + int offset; + + if (cc && *cc) { + tempMailTo = estrdup(cc); + bufferCc = (char *)emalloc(strlen(cc)); + offset = 0; + addr = NULL; + rfc822_parse_adrlist(&addr, tempMailTo, NULL); + while (addr) { + if (strcmp(addr->host, ERRHOST) == 0) + return (BAD_MSG_DESTINATION); + else { + offset += sprintf(bufferCc + offset, "%s@%s,", addr->mailbox, addr->host); + } + addr = addr->next; + } + efree(tempMailTo); + bufferCc[offset] = 0; + } + + if (bcc && *bcc) { + tempMailTo = estrdup(bcc); + bufferBcc = (char *)emalloc(strlen(bcc)); + offset = 0; + addr = NULL; + rfc822_parse_adrlist(&addr, tempMailTo, NULL); + while (addr) { + if (strcmp(addr->host, ERRHOST) == 0) + return (BAD_MSG_DESTINATION); + else { + offset += sprintf(bufferBcc + offset, "%s@%s,", addr->mailbox, addr->host); + } + addr = addr->next; + } + efree(tempMailTo); + bufferBcc[offset] = 0; + } + + + if (TSendMail(INI_STR("SMTP"), &tsm_err, NULL, headers, subject, to, message, bufferCc, bufferBcc, rpath) != SUCCESS) { php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), GetSMErrorText(tsm_err)); return 0; } + if (bufferCc) efree(bufferCc); + if (bufferBcc) efree(bufferBcc); #else if (!INI_STR("sendmail_path")) { return 0;