need help sending email from php

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm trying to send email from a php script (not my code) and the mail is
being rejected by my isp's qmail server. It says that I have illegal
crcr's where I should have crlf's. I'm not sure what to do. Here is the
code if it gives any clues. Also, if someone could enlighten me on how
those $this-> lines work I'd appreciate it.

Thanks for any help.

   function send() {
      global $language;
      if (empty($this->to) || empty($this->from)) {
         return false;
      if (isset($_SESSION["tp"]->email_prefix) &&
!empty($_SESSION["tp"]->email_prefix)) {
         $this->subject = '['.$_SESSION["tp"]->email_prefix.']
      $cc = "";
      if (!empty($this->cc)) {
         $cc = "Cc: ".$this->cc."\n";
      $bcc = "";
      if (!empty($this->bcc)) {
         $bcc = "Bcc: ".$this->bcc."\n";
      if (empty($this->reply_to)) {
         $this->reply_to = $this->from;
         $this->reply_to_name = $this->from_name;
      if (empty($this->charset)) {
         $this->charset = $language->charset;
      //$body  =~ s/\r\r/\r\f/g, $body;

      $sent = mail($this->to
                  ,'From: "'.$this->from_name.'" <'.$this->from.'>'."\n"
                  .'Reply-To: "'.$this->reply_to_name.'"
                  .'Return-Path: "'.$this->reply_to_name.'"
                  .'Date: '.date('r')."\n"
                  .'Content-Type: text/plain;
      if ($sent != false) {
         return true;
      else {
         return false;

Re: need help sending email from php

Dave Calhoun wrote:
Quoted text here. Click to load it

Replace every occurrence of "\n" with "\r\n" and see if
it solves the problem.


Site Timeline