This is our sendmail function:
function sendEmail($senderName, $senderEmail, $sendToAddress,
$subject, $message, $cc="", $bcc="") {
//error_reporting(E_ALL);
$this->sendEmailMessage = "Failed to send email. ";
$returnValue = false;
if(isset($senderName) && isset($senderEmail) &&
isset($sendToAddress) && isset($subject) && isset($message)){
$subject=stripslashes($subject);
$message=stripslashes($message);
$header = "Content-Type: text/plain; charset=\"us-ascii\"\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Subject: ". $subject . "\r\n";
$header .= "From: ". $senderEmail . "\r\n";
if(isset($cc) && $cc !="") {
$header .= "cc: ". $cc . "\r\n";
}
if(isset($bcc) && $bcc !="") {
$header .= "bcc: ". $bcc . "\r\n";
}
$mailTo = $sendToAddress;
$returnValue = mail($mailTo, $subject, $message, $header);
$this->sendEmailMessage = "Successfully sent email. ";
}else{$this->sendEmailMessage = "One or more parameters failed. ";}
return $returnValue;
}// end of sendEmail()
The from part of the header is there and is working. The following is
part of the email notifying me of a bad sender.
=== snipit ====
----- The following addresses had permanent fatal errors -----
<[EMAIL PROTECTED]>
(reason: 550 [PERMFAIL] comcast.net requires valid sender domain)
----- Transcript of session follows -----
... while talking to gateway-a.comcast.net.:
DATA
<<< 550 [PERMFAIL] comcast.net requires valid sender domain
550 5.1.1 <[EMAIL PROTECTED]>... User unknown
<<< 503 need RCPT command [data]
--kBF0HrGi008699.1166141873/web.alpine.k12.ut.us
Content-Type: message/delivery-status
Reporting-MTA: dns; web.alpine.k12.ut.us
Received-From-MTA: DNS; web.alpine.k12.ut.us
Arrival-Date: Thu, 14 Dec 2006 17:17:52 -0700
Final-Recipient: RFC822; [EMAIL PROTECTED]
Action: failed
Status: 5.1.1
Remote-MTA: DNS; gateway-a.comcast.net
Diagnostic-Code: SMTP; 550 [PERMFAIL] comcast.net requires valid sender domain
Last-Attempt-Date: Thu, 14 Dec 2006 17:17:53 -0700
--kBF0HrGi008699.1166141873/web.alpine.k12.ut.us
Content-Type: message/rfc822
Return-Path: <[EMAIL PROTECTED]>
Received: from web.alpine.k12.ut.us (web.alpine.k12.ut.us [127.0.0.1])
by web.alpine.k12.ut.us (8.13.7/8.13.7) with ESMTP id kBF0HqGi008697;
Thu, 14 Dec 2006 17:17:52 -0700
Received: (from [EMAIL PROTECTED])
by web.alpine.k12.ut.us (8.13.7/8.13.7/Submit) id kBF0HqLF008696;
Thu, 14 Dec 2006 17:17:52 -0700
Date: Thu, 14 Dec 2006 17:17:52 -0700
Message-Id: <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Parent Message: Parent of Dallin Ricardson
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Subject: Parent Message: Parent of Dallin Ricardson
From: [EMAIL PROTECTED]
cc: [EMAIL PROTECTED]
This is an email message generated by the Alpine School District email system.
Sender: AAAA AAAAAAAA
Email Address of Sender: [EMAIL PROTECTED]
MESSAGE:
Mrs. MMMMMMMMM,
=== snipit ===
Notice this is a 550 error. The server thinks I am a spammer. I have
a good to, from, and cc, but the sender information is
apache@<computer name>
Hope this helps to clarify,
-Daniel
On 12/14/06, Stephen Ward <[EMAIL PROTECTED]> wrote:
>
> You need to insert a "From:" line in the mail headers. That's the
> fourth parameter of the mail() function. Thus, you'd do something
> like:
>
> mail("[EMAIL PROTECTED]", "subject", "message", "From: [EMAIL PROTECTED]");
Actually, to be exact, the fourth parameter of PHP's mail() function is a
string of "additional_headers". It can contain things like "From:
[EMAIL PROTECTED]", "Content-type: text/plain", and other email header
goodies.
Cheers,
Stephen
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/