[KLUG Members] php mail problem (source code)
Todd Pillars
members@kalamazoolinux.org
Mon, 19 Aug 2002 13:20:12 -0400
The only thing I can see that might be out of place is the Date: field in
your $headers try:
$headers = "From: \"" . $formname . "\" <" . $formemail . ">\r\n";
// notice the \r\n - some (most) Unix (linux) MTA's require this
// sequence over just the newline char
$headers .= "Reply-to: \"". $formname . "\" <". $formemail .">\r\n;
$headers .= "Date: " . date("D, d M Y G:i:s Z") . "\r\n";
// notice the _ d _ instead of _ j _ I thought RFC 821 for SMTP requires
// leading zero in day but not the case, I use it though
$headers .= "X-Mailer:PHP/" . phpversion() . "\r\n";
// just being nice to the MTA here
I am still confused as to why the Return-Path is blank <> on the orginal
message. Are all variables passing correctly?
information was obtained from RFC 821 @ http://www.ietf.org/rfc/rfc0821.txt
hope this helps
t.
-----Original Message-----
From: members-admin@kalamazoolinux.org
[mailto:members-admin@kalamazoolinux.org]On Behalf Of Russell Dillenburg
Sent: Saturday, August 17, 2002 11:54 PM
To: members@kalamazoolinux.org
Subject: RE: [KLUG Members] php mail problem (source code)
Here's a copy of the class file
// contact_.phpclass contactme {
var $ip;
var $admin_mail = "rdillenbu@yahoo.com";
function contactme ($ip) {
$this->ip = $ip;
}
function _sendMail($formname, $formemail, $formcomments, $formsubject) {
$headers = "From: \"$formname\"<$formemail>\n";
$headers .= "Date: " .date("D, j M Y G:i:s Z"). "\n";
if ($formname && $formemail && $formcomments) {
$mStrmail = "$formcomments";
$mSend = mail ($this->admin_mail, $formsubject, $mStrmail,
$headers);
if ($mSend) {
include
("http://russell.knightec.net/contact/confirm.php?comments=$formcomments&nam
e=$formname");
exit;
} else {
include
("http://russell.knightec.net/contact/error.php?mSend=$mSend");
exit;
}
} else
include ("http://russell.knightec.net/contact/user_error.html");
exit;
}
}
I'm instantiating it in this file:
//contact.php include("../contact_.php");
$contact = new contactme ($REMOTE_ADDR);
if ( $SUBMIT == "Send" ) {
$contact->_sendMail($name, $email, $comments, $subject);
}
Todd Pillars wrote:
what version of php? and are you cc or Bcc to anyone when you mail()?
also make sure all your php.ini params are correct - go through line by
line - specifically check about line 310-311 for your sendmail options
right now your script is running as apache and is defaulting to
apache@hercules (localhost) make sure your script is sending a fully
qualified domain. ie webmaster@your.com for the From: field which in turn
will default to the Return-to field.
and check http://www.php.net/manual/en/function.mail.php to catch all the
things I missed : )
Todd
-----Original Message-----
From: members-admin@kalamazoolinux.org
[mailto:members-admin@kalamazoolinux.org]On Behalf Of Russell Dillenburg
Sent: Saturday, August 17, 2002 10:55 PM
To: members@kalamazoolinux.org
Subject: [KLUG Members] php mail problem
Hi,
My server seems to be having trouble sending emails. I noticed when I tried
emailing in one of my php scripts, http://russell.knightec.net/contact/. I
included below what gets bounced back to me.
If you were to try and send a message using that it'll just come back to
from mail daemon. I had this working before, but forget how, or what I did.
Maybe something about my hostname/domain? I am using the mail function in
php to send. This has worked fine in the past (old server).
Thanks for any help!
Russell Dillenburg
>From Mail Delivery Subsystem Sat Aug 17 19:46:00 2002
X-Apparently-To:rdillenbu@yahoo.com via -40.-120.-81.80; 17 Aug 2002
19:51:16 -0700 (PDT)
Return-Path:<>
Received:from 209.68.1.157 (HELO gwind.pair.com) (209.68.1.157) by
mta624.mail.yahoo.com with SMTP; 17 Aug 2002 19:51:16 -0700 (PDT)
Received:(qmail 1411 invoked by uid 3036); 18 Aug 2002 02:51:15 -0000
Delivered-To:jfd-dillenburg:org-russell@dillenburg.org
Received:(qmail 1408 invoked from network); 18 Aug 2002 02:51:14 -0000
Received:from 12-251-0-48.client.attbi.com (HELO hercules) (12.251.0.48) by
gwind.pair.com with SMTP; 18 Aug 2002 02:51:14 -0000
Received:from localhost (localhost) by hercules (8.11.6/8.11.6) id
g7I2k0B09115; Sat, 17 Aug 2002 21:46:00 -0500
Date:Sat, 17 Aug 2002 21:46:00 -0500
From:"Mail Delivery Subsystem" <MAILER-DAEMON@hercules> | This is Spam | Add
to Address Book
Message-Id:<200208180246.g7I2k0B09115@hercules>
To:apache@hercules
MIME-Version:1.0
Content-Type:multipart/report; report-type=delivery-status;
boundary="g7I2k0B09115.1029638760/hercules"
Subject:Returned mail: see transcript for details
Auto-Submitted:auto-generated (failure)
Content-Length:625
The original message was received at Sat, 17 Aug 2002 21:46:00 -0500
from apache@localhost
----- The following addresses had permanent fatal errors -----
rdillenbu@yahoo.com
(reason: 501 Syntax error in parameters or arguments)
----- Transcript of session follows -----
... while talking to mx1.mail.yahoo.com.:
>>> MAIL From:<apache@hercules> SIZE=159
<<< 501 Syntax error in parameters or arguments
501 5.6.0 Data format error
Message/delivery-status
Reporting-MTA: dns; hercules
Arrival-Date: Sat, 17 Aug 2002 21:46:00 -0500
Final-Recipient: RFC822; rdillenbu@yahoo.com
Action: failed
Status: 5.5.2
Diagnostic-Code: SMTP; 501 Syntax error in parameters or arguments
Last-Attempt-Date: Sat, 17 Aug 2002 21:46:00 -0500
Forwarded Message [ Save to my Yahoo! Briefcase | Download File ]
Return-Path:<apache>
Received:(from apache@localhost) by hercules (8.11.6/8.11.6) id
g7I2k0C09112; Sat, 17 Aug 2002 21:46:00 -0500
Message-Id:<200208180246.g7I2k0C09112@hercules>
To:rdillenbu@yahoo.com
Subject:Message from website
From:"testing" <russell@test.dillenburg.org>
Date:Sat, 17 Aug 2002 21:45:59 -18000
testing stuff here
--
Russell Dillenburg
"The software business is binary, you're either a 1 or a 0--alive or dead."
Do You Yahoo!?
HotJobs, a Yahoo! service - Search Thousands of New Jobs
--
Russell Dillenburg
"The software business is binary, you're either a 1 or a 0--alive or dead."
Do You Yahoo!?
HotJobs, a Yahoo! service - Search Thousands of New Jobs