#14166 [Opn->Csd]: patch for mail() to use sendmail_from on Unix
| From: | derick@php.net | Date: | Wed, 26 Feb 2003 20:15:03 +0000 |
| Subject: | #14166 [Opn->Csd]: patch for mail() to use sendmail_from on Unix | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-34362@lists.php.net to get a copy of this message | ||
ID: 14166
Updated by: derick@php.net
Reported By: sury dot ondrej at globe dot cz
-Status: Open
+Status: Closed
Bug Type: Feature/Change Request
Operating System: Linux
PHP Version: 4.0.6
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
From PHP 5 you can force the extra parameters to be set with the ini
setting "mail_force_extra_parameters", see also:
http://news.php.net/article.php?group=php.cvs&article=19210
Derick
Previous Comments:
------------------------------------------------------------------------
[2001-11-21 14:49:46] sury dot ondrej at globe dot cz
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) {
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=14166&edit=1