Re: vhost in mail

From: Date: Mon, 01 Nov 2004 18:53:10 +0000
Subject: Re: vhost in mail
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-13676@lists.php.net to get a copy of this message
> 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

« previous php.internals (#13676) next »