|
Posted by crazycooter on 08/01/07 21:49
I found an old thread on this (http://groups.google.com/group/alt.php/
browse_thread/thread/751edb9c723316c4/ea9bf92a9c6b807c?lnk=gst&q=mail()
+duplicate&rnum=7#ea9bf92a9c6b807c), but there didnt seem to be a
resolution. I also noticed that this was a pretty old thread and there
didn't seem to be anything newer in the search results.
Regardless, I have a very similar problem; I am consistently getting
five emails per each PHP mail() call. While this originally showed up
in a loop generating a flood of email, I explicitly made a single
direct mail call using hard coded strings and I confirmed the same
behavior. I have spent most of today fighting with this and I can
confidently rule out that the mail() function is being accidentally
called multiple times (unless PHP is reloading the page multiple times
before finally rendering back or something else really bizarre)
Here is an example:
$result = mail($sendto, $subject, $messagebody, $headers);
If it matters, this is being called via a wrapper function, like this:
function send_email($email_from, $email_to, $subject, $msg,
$show_result = null)
{
...
$headers = "From: $from \r\n";
$headers .= "Reply-To: $from \r\n";
...
$result = mail($sendto, $subject, $messagebody, $headers);
...
}
The values of the vars don't matter, as I ran a very simple mail with
hard coded strings and got exactly the same behavior.
I have searched extensively and I cant seem to find anything that
specifically nails down why this might happen. For those interested in
the mail headers generated by a single mail() call, here is what I get
(some data scrubbed out):
########################
Received: from crazycooter [67.110.67.194] by XXXXX.marketnet.com
(SMTPD-9.10) id A208038C; Wed, 01 Aug 2007 12:25:28 -0500
Date: Wed, 01 Aug 2007 12:25:17 -0500
Subject: Subject
To: YYYYY.ZZZZZ@MarketNet.com
From: AAAAA.BBBBB@MarketNet.com
Reply-To: AAAAA.BBBBB@MarketNet.com
Message-Id: <200708011225863.SM03756@crazycooter>
X-RCPT-TO: <YYYYY.ZZZZZ@MarketNet.com>
Status:
X-UIDL: 471469545
X-IMail-ThreadID: c208071f0000b881
########################
Received: from crazycooter [67.110.67.194] by XXXXX.marketnet.com
(SMTPD-9.10) id A2020370; Wed, 01 Aug 2007 12:25:22 -0500
Date: Wed, 01 Aug 2007 12:25:11 -0500
Subject: Subject
To: YYYYY.ZZZZZ@MarketNet.com
From: AAAAA.BBBBB@MarketNet.com
Reply-To: AAAAA.BBBBB@MarketNet.com
Message-Id: <200708011225800.SM02212@crazycooter>
X-RCPT-TO: <YYYYY.ZZZZZ@MarketNet.com>
Status:
X-UIDL: 471469541
X-IMail-ThreadID: c20100e10000b872
########################
Received: from crazycooter [67.110.67.194] by XXXXX.marketnet.com
(SMTPD-9.10) id A20304C4; Wed, 01 Aug 2007 12:25:23 -0500
Date: Wed, 01 Aug 2007 12:25:13 -0500
Subject: Subject
To: YYYYY.ZZZZZ@MarketNet.com
From: AAAAA.BBBBB@MarketNet.com
Reply-To: AAAAA.BBBBB@MarketNet.com
Message-Id: <200708011225488.SM03132@crazycooter>
X-RCPT-TO: <YYYYY.ZZZZZ@MarketNet.com>
Status:
X-UIDL: 471469542
X-IMail-ThreadID: c20301a00000b875
########################
Received: from crazycooter [67.110.67.194] by XXXXX.marketnet.com
(SMTPD-9.10) id A20503A8; Wed, 01 Aug 2007 12:25:25 -0500
Date: Wed, 01 Aug 2007 12:25:15 -0500
Subject: Subject
To: YYYYY.ZZZZZ@MarketNet.com
From: AAAAA.BBBBB@MarketNet.com
Reply-To: AAAAA.BBBBB@MarketNet.com
Message-Id: <200708011225363.SM03132@crazycooter>
X-RCPT-TO: <YYYYY.ZZZZZ@MarketNet.com>
Status:
X-UIDL: 471469543
X-IMail-ThreadID: c20507190000b87a
########################
Received: from crazycooter [67.110.67.194] by XXXXX.marketnet.com
(SMTPD-9.10) id A20703A8; Wed, 01 Aug 2007 12:25:27 -0500
Date: Wed, 01 Aug 2007 12:25:16 -0500
Subject: Subject
To: YYYYY.ZZZZZ@MarketNet.com
From: AAAAA.BBBBB@MarketNet.com
Reply-To: AAAAA.BBBBB@MarketNet.com
Message-Id: <200708011225706.SM03132@crazycooter>
X-RCPT-TO: <YYYYY.ZZZZZ@MarketNet.com>
Status:
X-UIDL: 471469544
X-IMail-ThreadID: c20600e10000b87d
########################
I am developing locally right now on a WinXP box (SP2) with PHP 5 via
IIS. If it matters, I had to configure IIS such that .html extensions
are mapped to "C:\Progra~1\PHP\php5isapi.dll" for GET,POST, and HEAD
since this clients site is all .html files with embedded PHP. The SMTP
is an exchange server.
I didn't develop this app, but I do need to support it, so any
guidance from someone more knowledgeable would be greatly appreciated.
Regards,
CrazyCooter
Navigation:
[Reply to this message]
|