Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13676 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70660 invoked by uid 1010); 1 Nov 2004 18:54:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 68676 invoked by uid 1007); 1 Nov 2004 18:53:55 -0000 Message-ID: <20041101185355.68675.qmail@pb1.pair.com> To: internals@lists.php.net References: <20041101170256.87854.qmail@pb1.pair.com> Date: Mon, 1 Nov 2004 10:53:10 -0800 Lines: 47 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Posted-By: 169.229.135.175 Subject: Re: vhost in mail From: pollita@php.net ("Sara Golemon") > in the phpinfo() I can find (apache2handler) the entry: "Hostname:Port", > which displays the vhost you are running the script from. > In [phpsources]/sapi/apache2handler/php_functions.c I found the source. Now > I want to display the vhost in every mail, which is sent by php. I know that > the source is in [phpsources]/ext/standard/mail.c and I know how to add a > simple text, but I don't know how to insert the vhost. > With two HUGE caveats: Index: ext/standard/mail.c =================================================================== RCS file: /repository/php-src/ext/standard/mail.c,v retrieving revision 1.84 diff -u -r1.84 mail.c --- ext/standard/mail.c 25 Sep 2004 14:48:44 -0000 1.84 +++ ext/standard/mail.c 1 Nov 2004 18:50:16 -0000 @@ -180,6 +180,7 @@ int ret; char *sendmail_path = INI_STR("sendmail_path"); char *sendmail_cmd = NULL; + server_rec *serv = ((php_struct *) SG(server_context))->r->server; if (!sendmail_path) { #if (defined PHP_WIN32 || defined NETWARE) @@ -229,6 +230,8 @@ #endif fprintf(sendmail, "To: %s\n", to); fprintf(sendmail, "Subject: %s\n", subject); + fprintf(sendmail, "X-Server-Hostname: %s\n", serv->server_hostname); + fprintf(sendmail, "X-Server-Port: %d\n", serv->port); if (headers != NULL) { fprintf(sendmail, "%s\n", headers); #1) Assumes Apache2handler (probably fine since you'll be doing this on your server only) #2) Havn't tested it. Use at your own risk. No warranties either expressed or implied. -Sara