need help sending email from php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave Calhoun

    need help sending email from php

    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.
    Dave



    function send() {
    global $language;
    if (empty($this->to) || empty($this->from)) {
    return false;
    }
    if (isset($_SESSIO N["tp"]->email_prefix ) &&
    !empty($_SESSIO N["tp"]->email_prefix )) {
    $this->subject = '['.$_SESSION["tp"]->email_prefix .']
    '.$this->subject;
    }
    $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_nam e = $this->from_name;
    }
    if (empty($this->charset)) {
    $this->charset = $language->charset;
    }
    //$body =~ s/\r\r/\r\f/g, $body;




    $sent = mail($this->to
    ,$this->subject
    ,$this->body
    ,'From: "'.$this->from_name.'" <'.$this->from.'>'."\n "
    .'Reply-To: "'.$this->reply_to_name. '"
    <'.$this->reply_to.'>'." \n"
    .'Return-Path: "'.$this->reply_to_name. '"
    <'.$this->reply_to.'>'." \n"
    .$cc
    .$bcc
    .'Date: '.date('r')."\n "
    .'Content-Type: text/plain;
    charset='.$this->charset."\n.\n "
    );

    if ($sent != false) {
    return true;
    }
    else {
    return false;
    }
    }

    }
  • NC

    #2
    Re: need help sending email from php

    Dave Calhoun wrote:[color=blue]
    >
    > 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.[/color]

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

    Cheers,
    NC

    Comment

    Working...