sendmail woes

Daniel teletautala at gmail.com
Thu Dec 14 16:35:32 MST 2006


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 -----
<XXXXXXXXXX at comcast.net>
    (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 <XXXXXXXXXX at comcast.net>... 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; XXXXXXXXXXXX at comcast.net
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: <apache at web.alpine.k12.ut.us>
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 apache at localhost)
        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: <200612150017.kBF0HqLF008696 at web.alpine.k12.ut.us>
To: TTTTTTTTT at alpine.k12.ut.us
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: XXXXXXXXXXX at comcast.net
cc: XXXXXXXXXXXX at comcast.net


This is an email message generated by the Alpine School District email system.
Sender: AAAA AAAAAAAA
Email Address of Sender: XXXXXXXXXXXX at comcast.net

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 <sjward at gmail.com> 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("to at place.com", "subject", "message", "From: from at place.com");
>
>
> Actually, to be exact, the fourth parameter of PHP's mail() function is a
> string of "additional_headers".  It can contain things like "From:
> soandso at suchandsuch.com", "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.
> */
>



More information about the PLUG mailing list