// ad poster sidebar contact form email
function cp_contact_ad_owner_email($postID) {
    // wp_mail doesn't seem to work with cc or bcc in headers (as of 2.9.2)
    // this is here for adding it later
    // $Cc = 'youremailaddress@domain.com';
    // $Bcc = get_option('admin_email');
    // check to see if ad is legacy or not
    if(get_post_meta($postID, 'email', true))
        $mailto = get_post_meta($postID, 'email', true);
    else
        $mailto = get_the_author_meta('user_email');
    $from_name = strip_tags($_POST['from_name']);
    $from_email = strip_tags($_POST['from_email']);
    //$mailto = 'testing@appthemes.com'; // USED FOR TESTING
    $subject = strip_tags($_POST['subject']);
    $headerPic = '<IMG height=97 src="http://www.e-connect.net.au/wp-content/themes/classipress/images/eheader.png">';
    $headers .= "Content-Type: text/html\r\n";
    $headers = "From: $from_name <$from_email> \r\n";
    $headers .= "Reply-To: $from_name <$from_email> \r\n";
    // $headers .= "Cc: $Cc \r\n";
    // $headers .= "BCC: $Bcc \r\n";
    // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    // we want to reverse this for the plain text arena of emails
    $sitename = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    $siteurl = trailingsla****(get_option('home'));
    $permalink = get_permalink();
    $message = $headerPic;
    $message  = sprintf(__('A potential buyer has inquired about your listing: %s', 'appthemes'), $permalink) . "\r\n\r\n";
    $message .= sprintf(__('Ad Reference ID :', 'appthemes'), $cp_sys_ad_conf_id) . "\r\n\r\n";
    $message .= sprintf(__('Category :', 'appthemes'), $cat) . "\r\n\r\n";
    $message .= sprintf(__('Listing Title:', 'appthemes'), $post_title) . "\r\n\r\n";
    $message .= sprintf(__('Description:', 'appthemes'), $post_content) . "\r\n\r\n";
    $message .= sprintf(__('Price:', 'appthemes'), $cp_price) . "\r\n\r\n";
    $message .= sprintf(__('City:', 'appthemes'), $cp_city) . "\r\n\r\n";
    $message .= sprintf(__('State:', 'appthemes'), $cp_state) . "\r\n\r\n";
    // $message  = sprintf(__('From: %s - %s', 'appthemes'), $from_name, $from_email) . "\r\n\r\n";
        $fixPostMessage = stripslashes($_POST['message']);
    $message .= '"' . wordwrap(strip_tags($fixPostMessage), 70) . '"' . "\r\n\r\n\r\n";
    $message .= sprintf(__('Name: %s', 'appthemes'), $from_name) . "\r\n";
    $message .= sprintf(__('E-mail: %s', 'appthemes'), $from_email) . "\r\n\r\n\r\n\r\n";
    $message .= "Phone : ".wordwrap(strip_tags($_POST['phone']), 70) . "\r\n\r\n";
    $message .= '-----------------------------------------' . "\r\n";
    $message .= sprintf(__('Kind regards, %s', 'appthemes'), $sitename) . "\r\n";
    $message .=  $siteurl . "\r\n\r\n";
    // ok let's send the email
    wp_mail($mailto, $subject, $message, $headers);
} 
There are currently 1 users browsing this thread. (0 members and 1 guests)