Help with PHP Emailer

Discussion in 'PHP' started by finx, Sep 23, 2010.

  1. #1
    Please tell me what is wrong with this script. It wont work.

    <?php

    class Mailer {
    function send( $msg, $to = null ) {
    $from = get_option( 'price-calc-email' );
    if( !$to )
    $to = $from;

    $message .= "$msg\r\n\r\n";
    $subject = get_option( 'price-calc-subject' );
    $headers = 'From: '. $from . "\r\n" .
    "Content-type: text/html\r\n";
    'Reply-To: ' . $from . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

    return @mail( $to, $subject, $message, $headers );
    }
    }

    ?>


    It's actually a plugin for wordpress that I cant seem to figure out.

    The files for this plugin is here http://www.thickthumb.com/open-source/price-calc/
    Please help if anybody can.
     
    finx, Sep 23, 2010 IP
  2. finx

    finx Greenhorn

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    15
    #2
    Sorry, I forgot some information. I'm trying to have php email me when a customer fills out a form and hits submit. Thats all I want it to do. As of right now it doesnt email me or anything. Thanks again!
     
    finx, Sep 23, 2010 IP
  3. ilovespy

    ilovespy Guest

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    'Content-type: text/html\r\n' . <--it should be a dot.. not semicolon..
     
    ilovespy, Sep 24, 2010 IP
  4. HungryMinds

    HungryMinds Active Member

    Messages:
    216
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #4
    Hi!

    Try This:

    
    $headers = "From: " . $from . "\r\n" . " Content-type: text/html\r\n" . " Reply-To: " . $from . "\r\n" . " X-Mailer: PHP/" . phpversion();
    
    Code (markup):
    OR

    
    $headers = "From: " . $from . "\r\n ";
    $headers. = "Content-type: text/html\r\n ";
    $headers. = "Reply-To: " . $from . "\r\n ";
    $headers. = "X-Mailer: PHP/" . phpversion();
    
    Code (markup):
     
    HungryMinds, Sep 24, 2010 IP