|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-02-26 14:15 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 19:00:01 2025 UTC |
This patch allows setup Return-path: per virtual host and thus identify real sender of mail message. It is really usefull to identify source of spam and such. O. --- php4-4.0.100.orig/ext/standard/mail.c Mon Jul 30 08:18:06 2001 +++ php4-4.0.100/ext/standard/mail.c Wed Nov 21 20:44:53 2001 @@ -142,8 +142,10 @@ #endif FILE *sendmail; int ret; + static int sendmail_cmd_len = 0; char *sendmail_path = INI_STR("sendmail_path"); - char *sendmail_cmd = NULL; + char *sendmail_from = INI_STR("sendmail_from"); + char *sendmail_cmd = NULL; if (!sendmail_path) { #ifdef PHP_WIN32 @@ -157,11 +159,18 @@ return 0; #endif } - if (extra_cmd != NULL) { - sendmail_cmd = emalloc (strlen (sendmail_path) + strlen (extra_cmd) + 2); + if ((extra_cmd != NULL) || (sendmail_from != NULL)) { + sendmail_cmd = emalloc (((extra_cmd != NULL)?strlen(extra_cmd)+1:0) + + ((sendmail_from != NULL)?strlen(sendmail_from)+3:0) + strlen(sendmail_path) + 1); strcpy (sendmail_cmd, sendmail_path); - strcat (sendmail_cmd, " "); - strcat (sendmail_cmd, extra_cmd); + if (extra_cmd != NULL) { + strcat (sendmail_cmd, " "); + strcat (sendmail_cmd, extra_cmd); + } + if (sendmail_from != NULL) { + strcat (sendmail_cmd, " -f"); + strcat (sendmail_cmd, sendmail_from); + } } else { sendmail_cmd = sendmail_path; } @@ -171,7 +180,7 @@ #else sendmail = popen(sendmail_cmd, "w"); #endif - if (extra_cmd != NULL) + if ((extra_cmd != NULL) || (sendmail_from != NULL)) efree (sendmail_cmd); if (sendmail) {