Ask your WordPress questions! Pay money and get answers fast! (more info)

debug email piping plugin for a support ticket theme WordPress

  • SOLVED

Hello,
I have a plugin (http://www.aveight.com/supportpress-email-piping-plugin/) + email piping script that is 80% working with a SupportPress (http://demo.woothemes.com/?name=supportpress). A couple of crucial things are not working:
1. received 'Registration Required' email autoresponder even though email is already registered.
2. received 'Mail Delivery Failed' notification

I'm on a Linux CentOS 5.9 with cPanel.
Have these installed:
-Mailparse pecl library
-PHP cli
-curl
-chmod 755 automail.php (doesn't say on the website documentation but helped to receive emails)

Other plugin configurations are met.

automail.php code below:
#!/usr/bin/php -q
<?php
/*********************************************************************
automail.php

PHP script used for remote email piping...same as as the perl version.

Peter Rotich <peter@osticket.com>
Copyright (c) 2006-2010 osTicket
http://www.osticket.com

Released under the GNU General Public License WITHOUT ANY WARRANTY.
See LICENSE.TXT for details.

vim: expandtab sw=4 ts=4 sts=4:
$Id: $
**********************************************************************/
#pre-checks
error_log("Oracle database not available!", 0);
function_exists('file_get_contents') or die('upgrade php >=4.3');
set_time_limit(30);
#Configuration: Enter the url and key. That is it.
# url=> URL to pipe.php e.g http://yourdomain.com/support/api/pipe.php
# key=> API's Key (see admin panel on how to generate a key)
$config=array('url'=>'http://mydomain.com/support/wp-content/plugins/email-reply/api/pipe.php',
'key'=>'my16digitkeyhere');

#read stdin
$data=file_get_contents('php://stdin');
if(empty($data)) die('Error reading stdin. No message');

#curl post
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$config['url']);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
curl_setopt($ch, CURLOPT_USERAGENT,$config['key']);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result=curl_exec($ch);
curl_close($ch);
$code=0;
if(preg_match('/HTTP\/.* ([0-9]+) .*/', $result, $status))
$code=$status[1];
//Depending on your MTA add the exit codes.
//echo $code;
?>


Latest versions: WordPress 3.5.2 + SupportPress 1.0.39
Assistance is much appreciated. Thank you.

Answers (1)

2013-06-29

Giri answers:

Check this page..

[[LINK href="http://osticket.com/wiki/Email_Piping#Mail_delivery_failed"]]http://osticket.com/wiki/Email_Piping#Mail_delivery_failed[[/LINK]]


Creativira comments:

cool. working on it now. Thank you.


Creativira comments:

That helped. I no longer get the 'Mail Delivery Failed.'

1/2 down. 1 more to go!


Giri comments:

Great. Could you explain your problem 1 little bit more?. I mean which one causing that problem. Your theme or plugin?


Creativira comments:

Here’s How it Works

Customer emails support@<yourcompany.com> with a request for help/bug report/etc. Your email server pipes the email to automailer.php (or automail.pl script depending on your preference) script loaded on the email server. The script recieves the message, and sends a curl request to the plugin running on your site. You configure the plugin to only accept mail from one ip address, and you create a sufficiently long password that’s present in both the automailer script and in the WordPress dashboard to prevent unauthorized emails coming in. <strong>The plugin checks to see if the incoming email is present in the registered users section, and if so, creates a new ticket and assigns the ticket to the default user in Supportpress. If not, the user is told to register and to try to send the email again once registration has been completed. </strong>All correspondance with the user appends ticket numbers to the subject line, so customers can simply reply to emails dispatched by Supportpress and see their responses appear inline in the respective ticket thread. Attachments can be enabled or disabled in the admin settings section. When Attachments are allowed, and the customer attaches a file, it is uploaded to the server and shown under the ticket info above the thread in the usual spot.

The bolded part does not work. Getting 'Registration Required' email.
When I was getting the 'Mail delivery failed' messages, error was 'Oracle database not available!'


Creativira comments:

p.s. since the piping feature is not available with the theme, I will assume it is from the plugin or automail.php script
'Oracle database not available!' is generated from the automail.php --not connect to mySQL of WordPress?


Giri comments:

Then I guess the problem is with your email piping plugin. Could you show me your plugin code? Not full plugin code. But the part where the text look like "Registration Required"..


Creativira comments:

<?php


class SupportObject {

//global uploads;

private $_to;
private $_delivered_to;
private $_from;
private $_subject;
private $_text;
private $_html;
private $_attachments;
private $_attachment_denied;

private $_ticket_id;
private $_owner;
private $_files;


function __construct()
{
$_files = array();
$_attachments = array();
} // function

function init(){

}

function loadObject($Parser){
$this->_to = $Parser->getHeader('to');
$this->_delivered_to = $Parser->getHeader('delivered-to');
$this->_from = $this->getOwnerEmail($Parser->getHeader('from'));
$this->_owner = $this->setOwnerID($this->_from);
//echo "OWNER:".$this->_from;
$this->_subject = $Parser->getHeader('subject');
$this->_text = $Parser->getMessageBody('text');
$this->_html = $Parser->getMessageBody('html');
$this->_attachments = $Parser->getAttachments();
$this->_ticket_id = $this->getTicketID();
echo 'tixid:' . $this->_ticket_id;
$this->parseAttachments();
return true;
}

function saveObject() {


$posted = array();

if($this->_owner > 0 && ($this->_ticket_id == 0 || $this->_ticket_id < 0)) {

if($this->getText() != '')
$comment_txt = $this->getText();
else
$comment_txt = $this->getHtml();

$posted['title'] = mb_decode_mimeheader($this->getSubject());
$posted['comment'] = mb_decode_mimeheader($comment_txt);
$posted['ticket_type'] = DEFAULT_TICKET_TYPE;
$posted['priority'] = DEFAULT_EMAIL_PRI;
$posted['responsible'] = DEFAULT_RESPONSIBILITY;
$posted['status'] = DEFAULT_TICKET_STATUS;
$posted['ticket_owner'] = $this->_owner;
$posted['tags'] = DEFAULT_EMAIL_TAGS ;

if( function_exists(woo_supportpress_process_new_ticket) ) {
$return = $this->woo_supportpress_process_new_ticket_pipe($posted,$_attachment_files);
}
if ( is_wp_error($return) )
echo '<div class="notice red delete"><span><p>'.$return->get_error_message().'</p></span></div>';//}

$_ticket_number = $return;

if($return > 0)
$_is_new_ticket_inserted =true;
else
$_is_new_ticket_inserted = false;

return $_is_new_ticket_inserted;

}

else if($this->_owner > 0)
//Is comment
{

$time = current_time('mysql');

$tick_mapped = $this->map_hash_to_ticket($this->_ticket_id);

if($tick_mapped >0 ) {

if ($this->getText() != '')
$comment_txt = $this->getText();
else
$comment_txt = $this->getHtml();

$comment_data = array(
'comment_post_ID' =>$tick_mapped,
'comment_author' => $this->getOwner()->user_login,
'comment_author_email' => $this->getOwner()->user_email,
'comment_author_url' => '',
'comment_content' => mb_decode_mimeheader($comment_txt),
'comment_type' => '',
'comment_parent' => 0,
'user_id' => 1,
'comment_author_IP' => '127.0.0.1',
'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
'comment_date' => $time,
'comment_approved' => 1
);



$comment_id = wp_insert_comment($comment_data);
do_action('comment_post', $comment_id, $commentdata['comment_approved']);


$this->add_attachment_meta($this->getFiles(),$uploads,$tick_mapped,$this->_owner);
}
if($comment_id > 0)
return true;
else
return false;

}

}

function getTo()
{
return $this->_to;
}
function getDeliveredTo()
{
return $this->_delivered_to;
}

function getFrom()
{
return $this->_from;
}
function getSubject()
{
return $this->_subject;
}

function getText()
{
return $this->_text;
}
function getHtml()
{
return $this->_html;
}

function getFiles()
{
if(isset($this->_files))
return $this->_files;
else
return array();
}

function parseAttachments()
{

$i=0;
$files=array();

global $uploads;
$uploads = wp_upload_dir();
foreach($this->_attachments as $attachment) {

$tmp_name = rand(1, 500);

// get the attachment name
$filename = mb_decode_mimeheader($attachment->getFilename());

$filen=$this->sanitize($tmp_name .'_'. $filename .'.'. end(explode(".", $filename)), true);
$abs_file_path = $uploads['path'].'/' . $filen;

// write the file to the directory you want to save it in
if ($fp = fopen($abs_file_path, 'w')) {
while($bytes = $attachment->read()) {
fwrite($fp, $bytes);
}
fclose($fp);
}

$files[$i] = array();

$files[$i]['filename'] = $filen;
$files[$i]['name'] = $abs_file_path;
$files[$i]['type'] = $attachment->getContentType();
$files[$i]['tmpname'] = $filen;
$files[$i]['error'] = '';
$files[$i]['size'] = $byte_sz;

$i++;

}

$this->_files = $files;


}

function ifFilesAttached(){

if(isset($_attachments))
return true;
else
return false;
}

function getOwner()
{
$o = get_userdata($this->getOwnerID());
return $o;
}


function getOwnerID()
{
return $this->_owner;
}

function getOwnerEmail($email)
{

//if($_owner >0)
if ($email != '')
{
$emails= $this->extract_emails_from($email);

return $emails[0];
}
else

return -1;


}

//Modifier

function checkOwnerID($user_id)
{
global $wpdb;

$count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->users WHERE ID = '$user_ID'"));

if($count == 1){ return true; }else{ return false; }
}

function setOwnerID($email) {

global $wpdb;
$from_addr = $email;
$wp_user_id = $wpdb->get_var("SELECT id FROM wp_users where user_email='" . $from_addr . "'");

//echo'yag:'.$wp_user_id;

return $wp_user_id;


}

function getTicketID() {
//echo "test";
$ticket_num = $this->detect_ticket_number($this->_subject);
//if($ticket_num >0 && $this->is_real_post($ticket_num))
// {
return $ticket_num;
//}else
// return -1;

}

function detect_ticket_number($subject) {

$ticket_number = -1;
/*preg_match_all("/\d+/", $subject, $text_nums);
$ticket_number = $text_nums[0][0];
*/

$rightofhash = explode('#',$subject);
$leftside = explode(' ',$rightofhash[1]);

$ticket_number =$leftside[0];

if($ticket_number =='')
$ticket_number = -1;

return $ticket_number;

}

function get_user_id_by_email($from) {
//todo: verify email formatting

}



function woo_supportpress_process_new_ticket_pipe($posted,$files) {
global $wpdb;
global $uploads;
$errors = new WP_Error();


/* Validate Requried Fields */
if (empty($posted['title'])) $errors->add('required-field', __('<strong>Error</strong> &ldquo;Title&rdquo; is a required field.', 'woothemes'));
if (empty($posted['comment'])) $errors->add('required-field', __('<strong>Error</strong> Please describe the problem.', 'woothemes'));

if (sizeof($errors->errors)>0) return $errors;

/* Author */
if ($posted['ticket_owner']>0) $post_author = $posted['ticket_owner']; else $post_author = get_current_user_id();

/* Create ticket */

$data = array(
'post_content' => $wpdb->escape($posted['comment']),
'post_title' => $wpdb->escape($posted['title']),
'post_status' => 'publish',
'post_author' => $post_author,
'post_type' => 'ticket'
);

$ticket_id = wp_insert_post($data);


$this->_ticket_id = $ticket_id;
if ($ticket_id==0 || is_wp_error($ticket_id)) wp_die( __('Error: Unable to create ticket.', 'woothemes') );

/* Set terms */

$terms = array();
if ($posted['priority']) $terms[] = get_term_by( 'id', $posted['priority'], 'ticket_priority')->slug;
if (sizeof($terms)>0) wp_set_object_terms($ticket_id, $terms, 'ticket_priority');

wp_set_object_terms($ticket_id, array(NEW_STATUS_SLUG), 'ticket_status');

/* Type */

$terms = array();
if ($posted['ticket_type']) $terms[] = get_term_by( 'id', $posted['ticket_type'], 'ticket_type')->slug;
if (sizeof($terms)>0) wp_set_object_terms($ticket_id, $terms, 'ticket_type');

/* Responsible */

if ($posted['responsible'] && $posted['responsible']>0) :
update_post_meta($ticket_id, '_responsible', $posted['responsible']);
else :
update_post_meta($ticket_id, '_responsible', '');
endif;

/* Status */

$terms = array();
if ($posted['status']) $terms[] = get_term_by( 'id', $posted['status'], 'ticket_status')->slug;
if (sizeof($terms)>0) wp_set_object_terms($ticket_id, $terms, 'ticket_status');

/* Tags */

if (isset($posted['tags']) && $posted['tags']) :

$tags = explode(',', trim(stripslashes($posted['tags'])));
$tags = array_map('strtolower', $tags);
$tags = array_map('trim', $tags);

if (sizeof($tags)>0) :
wp_set_object_terms($ticket_id, $tags, 'ticket_tags');
endif;

endif;

/* Attach file to ticket */

$this->add_attachment_meta($this->getFiles(),$uploads,$ticket_id,$this->_owner);

do_action('new_ticket', $ticket_id);
/* Attach file to ticket */

/* Successful, return ticket */
return $ticket_id;



}

function extract_emails_from($string){
$matches = array();
preg_match_all("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $string, $matches);
return $matches[0];
}

function sanitize($string = '', $is_filename = FALSE)
{
// Replace all weird characters with dashes
$string = preg_replace('/[^\w\-'. ($is_filename ? '~_\.' : ''). ']+/u', '-', $string);

// Only allow one dash separator at a time (and make string lowercase)
return mb_strtolower(preg_replace('/--+/u', '-', $string), 'UTF-8');
}



function add_attachment_meta($files_loaded,$uploads,$parent,$owner) {
$opt = get_option('email_reply_options');
global $uploads;
if ($files_loaded) :

if(isset($opt['allow_attachments'])) {

foreach ($files_loaded as $attachment){
$attachment_data = array(
'post_mime_type' => $attachment['type'],
'post_title' => preg_replace('/\.[^.]+$/', '', basename($attachment['filename'])),
'post_content' => '',
'post_status' => 'inherit',
'post_author' => $owner
);

//remove starting slash from upload path
$uploads_relative = substr($uploads['subdir'] .'/'. $attachment['filename'], 1);
$attachment_id = wp_insert_attachment( $attachment_data, $uploads_relative, $parent );
$attachment_metadata = wp_generate_attachment_metadata( $attachment_id, $attachment['name'] );
wp_update_attachment_metadata( $attachment_id, $attachment_metadata );

}
$this->_attachment_denied = false;
}
else
{
$this->_attachment_denied = true;

}
endif;
}


function mail_created_success()
{

$to = $this->getFrom();
//wp_mail($to, 'Ticket Successfully Created #' . $this->getTicketID(), '<p>Thank you for contacting us. This is an automated response confirming the receipt of your ticket. One of our agents will get back to you as soon as possible. For your records, the details of the ticket are listed below. When replying, please make sure that the ticket ID is kept in the subject line to ensure that your replies are tracked appropriately.</p>');


}

function mail_registration_needed()
{

$to = $this->getFrom();
wp_mail($to, 'Registration Required', '<p>I am Sorry.You must register at <a href="' . get_bloginfo('siteurl') . '/wp-login.php?action=register">' . get_bloginfo('siteurl') .'</a> to submit a trouble ticket</p>');

}




function mail_attachments_not_allowed() {

$user_info = get_userdata($this->_owner);
wp_mail($user_info->user_email, 'Attachments are not allowed at this time','<p>I am sorry, Email attachments are not currently supported. Please visit your ticket at ' . post_permalink($this->_ticket_id) . ' to send a file to the support team</p>');



}

function is_real_post($ticket_num) {

global $wpdb;
$sql ="SELECT ID FROM wp_posts WHERE ID='" . $ticket_num ."'";
$num = $wpdb->get_var($sql);

if($num == $ticket_num)
return true;
else
return false;

}

function map_hash_to_ticket($hash) {
global $wpdb;
$hash_stripped = mysql_real_escape_string($hash);
$sql = "SELECT post_id FROM wp_postmeta WHERE meta_key = '_ticket_hash' and meta_value = '" . $hash_stripped . "'";
error_log($sql . "TICKET:" . $hash);

$post_id = $wpdb->get_var($sql);
if($post_id != 0)
return $post_id;
else
return false;
}
function map_ticket_to_hash($ticket_id) {

$ticket_id = get_post_meta($ticket_id, '_ticket_hash');

if($ticket_id != '' || $ticket != '0')
return $ticket_id;
else
return false;

}


function isRegNeeded()
{
if($this->_owner ==0 || $this->_owner < 0) {
return true;
}
else
{
return false;
}
}

function unauthorizedAttachments()
{
if(isset($this->_attachments) && $this->_attachment_denied ==true) {
return true;
}
else
{
return false;
}
}


//class
}


?>


Giri comments:

Ok That error message has been triggered by mail_registration_needed() function.. Could you check your other plugin files and search for this code?

mail_registration_needed()

or

mail_registration_needed

Post the code here once you found it.


Creativira comments:

<?php
/*
Plugin Name: SupportPress Email Reply
Plugin URI: http://plugins.aveight.com
Description: Allow reply-by-email for support tickets
Author: Bryan Purcell
Author URI: http://aveight.com
Version: 0.1
Tags: woothemes,email reply
License: GPL2
*/
//require('api.inc.php');
define('ROOT_DIR',str_replace('\\\\', '/', realpath(dirname(__FILE__))).'/'); #Get real path for root dir ---linux and windows
define('INCLUDE_DIR',ROOT_DIR.'include/'); //Change this if include is moved outside the web path.
define("DEFAULT_EMAIL_PRI", 4);
define("DEFAULT_TICKET_TYPE", '');
define("DEFAULT_RESPONSIBILITY", '');
define("DEFAULT_TICKET_STATUS", 0);
define("DEFAULT_EMAIL_TAGS", 'emailed');

//require_once(INCLUDE_DIR.'class.mailparse.php');
require_once(INCLUDE_DIR.'class.format.php');
require_once(INCLUDE_DIR.'MimeMailParser.class.php');
require_once(INCLUDE_DIR.'class.supportobject.php');

require_once(ABSPATH . "wp-admin" . '/includes/file.php');
require_once(ABSPATH . "wp-admin" . '/includes/image.php');

$emailreply = new Email_Reply;

function map_ticket_to_hash($ticket_id) {

$ticket_id = get_post_meta($ticket_id, '_ticket_hash',true);

if($ticket_id != '' || $ticket != '0')
return $ticket_id;
else
return false;

}

function add_subject_number($subject, $comment_id) {

//Look up comment's parent

$comment = get_comment($comment_id);
$number = $comment->comment_parent;
return '#' .$number . ' ' . $subject;
}

add_filter('comment_notification_subject', '','');



class Email_Reply {


function init(){
remove_action('new_ticket', 'woo_supportpress_email_new_ticket', 1, 1);
remove_action('new_ticket', 'woo_supportpress_email_owner_of_new_ticket', 1, 1);
remove_action('new_ticket', 'woo_supportpress_email_assigned_to_new_ticket', 1, 1);
remove_action('comment_post', 'woo_supportpress_email_commented_item', 2);



remove_action('new_message', 'woo_supportpress_email_new_message', 1, 1);
remove_action('ticket_updated', 'woo_supportpress_email_updated_ticket', 1, 3);

}
function __construct()
{
new Email_Reply_Options;
add_action( 'admin_init', array( &$this, 'admin_init' ) );
add_action('admin_menu', array( &$this, 'plugin_admin_add_page'));


add_action( 'init', array( &$this, 'init' ) );
# Place your add_actions and add_filters here
} // function

function plugin_admin_add_page() {
add_options_page('Email Reply Plugin Page', 'Email Reply Plugin Menu', 'manage_options', 'plugin', array( &$this, 'email_reply_options_page') );
}

function email_reply_options_page() {

echo '<div>';
echo '<h2>Woothemes Supportpress Email Reply</h2>';
echo 'Options relating to the Woothemes Supportpress Email Reply Plugin.';
echo '<form action="options.php" method="post">';
settings_fields('email_reply_options');
do_settings_sections('plugin');

echo '<input name="Submit" type="submit" value="Save Changes" />';
echo '</form></div>';

}

function admin_init()
{
register_setting( 'email_reply_options', 'email_reply_options', array( &$this, 'email_reply_options_validate' ));

add_settings_section('plugin_main', 'General', array( &$this, 'plugin_section_text_general'), 'plugin');
add_settings_field('email_reply_plugin_setting_general_checkbox_allow_attachments', 'Allow Attachments', array( &$this, 'email_reply_plugin_setting_general_checkbox_allow_attachments'), 'plugin', 'plugin_main');
add_settings_field('email_reply_plugin_setting_general_checkbox_allow_piping', 'Allow Email Piping', array( &$this, 'email_reply_plugin_setting_general_checkbox_allow_piping'), 'plugin', 'plugin_main');



add_settings_section('plugin_main', 'Email Piping', array( &$this, 'plugin_section_text_email_piping'), 'plugin');
add_settings_field('plugin_text_string_ip', 'Whitelisted IP SMTP Server', array( &$this, 'email_reply_plugin_setting_email_piping_string_ip'), 'plugin', 'plugin_main');
add_settings_field('plugin_text_string_key', 'API Key (must be 16 characters long)', array( &$this, 'email_reply_plugin_setting_email_piping_string_key'), 'plugin', 'plugin_main');

} // function

// add the admin settings and such
function email_reply_options_validate($input) {
$newinput = $input;

if (preg_match( "/^(([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/", $input['allowed_ip']))
{
$newinput['allowed_ip'] = $input['allowed_ip'];
}
else
{
$newinput['allowed_ip'] = '';
add_settings_error( 'plugin_text_string_ip', 'texterror', 'Invalid IP Address', 'error' );

}


if (( strlen($input['api_key']) > 12 ) && (preg_match("/^.*(?=.{6,})(?=.*[a-zA-Z])[a-zA-Z0-9]+$/",$input['api_key'])))
{
$newinput['api_key'] = $input['api_key'];
}
else
{
$newinput['api_key'] ='';
add_settings_error( 'plugin_text_string_key', 'texterror', 'API key must contain numbers and letters with a length of at least 6 characters.', 'error' );

}



return $newinput;


}

function plugin_section_text_general() {
echo '<p>General settings for the woothemes supportpress email ticket posting plugin</p>';
}

function email_reply_plugin_setting_general_checkbox_allow_attachments() {
$options = get_option('email_reply_options');
echo "<input id='email_reply_plugin_setting_general_checkbox_allow_attachments' name='email_reply_options[allow_attachments]' type='checkbox' value='{$options['allow_attachments']}' "; if (isset($options['allow_attachments'])) echo ' checked="checked" '; echo " />";

}
function email_reply_plugin_setting_general_checkbox_allow_piping() {
$options = get_option('email_reply_options');
echo "<input id='email_reply_plugin_setting_general_checkbox_allow_piping' name='email_reply_options[allow_piping]' type='checkbox' value='{$options['allow_attachments']}' "; if (isset($options['allow_piping'])) echo ' checked="checked" '; echo " />";

}

function plugin_section_text_email_piping() {
echo '<p>Remote SMTP email piping settings.</p>';
}
function email_reply_plugin_setting_email_piping_string_ip() {
$options = get_option('email_reply_options');
echo "<input id='email_reply_plugin_setting_email_piping_string_ip' name='email_reply_options[allowed_ip]' size='40' type='text' value='{$options['allowed_ip']}' />";


}

function email_reply_plugin_setting_email_piping_string_key() {
$options = get_option('email_reply_options');
echo "<input id='email_reply_plugin_setting_email_piping_string_key' name='email_reply_options[api_key]' size='40' type='text' value='{$options['api_key']}' />";


}

function do_parse ($data){
global $uploads;

$uploads = wp_upload_dir();

$Parser = new MimeMailParser();
$Parser->setText($data);
//if(!$parser->decode()){ //Decode...returns false on decoding errors
//api_exit(EX_DATAERR,'Email parse failed ['.$parser->getError()."]\n\n".$data);
//}


$t = new SupportObject();

$t->loadObject($Parser);
$t->saveObject();
error_log($t->getFrom());

if($t->isRegNeeded())
{
$t->mail_registration_needed($t->getFrom());
}

else {
$t->mail_created_success();
}

if($t->unauthorizedAttachments())
{
$t->mail_attachments_not_allowed();
}






}
} // class

class Email_Reply_Options {

function Email_Reply_Options()
{
$this->__construct();
} // function

function __construct()
{
# Place your add_actions and add_filters here

//add_action('admin_menu', 'plugin_admin_add_page');
//$this->admin_init();

} // function

function email_reply()
{
$value = get_option('email_reply');
# echo your form fields here containing the value received from get_option
} // function



} // class



/*-----------------------------------------------------------------------------------*/
/* New Ticket Notices
/*-----------------------------------------------------------------------------------*/

function woo_supportpress_email_new_ticket_a( $ticket_id ) {

$ticket = get_post($ticket_id);
$auth_id = $ticket->post_author;
$user = new WP_User($auth_id);

if ($user->display_name !='') :
$display_name = $user->display_name;
else :
$display_name = __('Guest', 'woothemes');
endif;

// Send new ticket notification to admin
$subject = "#" . map_ticket_to_hash($ticket_id) . ' [' . get_bloginfo('name'). '] ' . __('New Ticket', 'woothemes');
$content = __("Hi there,\n\nA new ticket has been submitted by &ldquo;%s&rdquo;. To view this ticket click the link below:\n\n%s\n\nRegards,\n%s", 'woothemes');

$email_content = sprintf(
$content
, $display_name
, '<a href="'.get_permalink($ticket->ID).'">'.$ticket->post_title.'</a>'
, get_bloginfo('name')
);

woo_supportpress_send_mail( woo_supportpress_send_to( 'ticket' ), $subject, $email_content );
}

function woo_supportpress_email_owner_of_new_ticket_a( $ticket_id ) {

$ticket = get_post($ticket_id);

// Only send if ticket created on users behalf
if ($ticket->post_author == get_current_user_id()) return;

$user = get_user_by('id', $ticket->post_author);

// Send new ticket notification to admin
$subject = '#' . map_ticket_to_hash($ticket->ID) .' [' . get_bloginfo('name'). '] ' . __('New Ticket', 'woothemes');
$content = __("Hi there,\n\nA ticket has been created for your support issue. To view this ticket click the link below:\n\n%s\n\nRegards,\n%s", 'woothemes');

$email_content = sprintf(
$content
, '<a href="'.get_permalink($ticket->ID).'">'.$ticket->post_title.'</a>'
, get_bloginfo('name')
);

// Generate Headers
$header['From'] = get_bloginfo('name') . " <noreply@".$sitename.">";
$header['X-Mailer'] = "PHP" . phpversion() . "";
$header['Content-Type'] = get_option('html_type') . "; charset=\"". get_option('blog_charset') . "\"";

foreach ( $header as $key => $value ) {
$headers[$key] = $key . ": " . $value;
}
$headers = implode("\n", $headers);
$headers .= "\n";

// Filter
$headers = apply_filters('woo_supportpress_send_mail_headers', $headers);

wp_mail( $user->user_email, $subject, $email_content, $headers );
}

function woo_supportpress_email_assigned_to_new_ticket_a( $ticket_id ) {

$ticket = get_post($ticket_id);
$auth_id = $ticket->post_author;
$user = new WP_User($auth_id);

if ($user->display_name !='') :
$display_name = $user->display_name;
else :
$display_name = __('Guest', 'woothemes');
endif;

// Send ticket notification to assigned user
$assigned_user = get_user_by('id', get_post_meta( $ticket->ID, '_responsible', true));
if ($assigned_user && !is_wp_error($assigned_user) && $assigned_user->ID!=get_current_user_id()) :

$subject = '#' . map_ticket_to_hash($ticket->ID) . ' [' . get_bloginfo('name'). '] ' . __('Assigned to ticket', 'woothemes');
$content = __("Hi there %s,\n\nIt's your lucky day! A new ticket has been submitted by &ldquo;%s&rdquo; and assigned to you. To view this ticket click the link below:\n\n%s\n\nRegards,\n%s", 'woothemes');

$email_content = sprintf(
$content
, $assigned_user->display_name
, $display_name
, '<a href="'.get_permalink($ticket->ID).'">'.$ticket->post_title.'</a>'
, get_bloginfo('name')
);

// Generate Headers
$header['From'] = get_bloginfo('name') . " <noreply@".$sitename.">";
$header['X-Mailer'] = "PHP" . phpversion() . "";
$header['Content-Type'] = get_option('html_type') . "; charset=\"". get_option('blog_charset') . "\"";

foreach ( $header as $key => $value ) {
$headers[$key] = $key . ": " . $value;
}
$headers = implode("\n", $headers);
$headers .= "\n";

// Filter
$headers = apply_filters('woo_supportpress_send_mail_headers', $headers);

wp_mail( $assigned_user->user_email, $subject, $email_content, $headers );

endif;
}


function apply_hash($ticket_id) {
$hash_val = uniqid();

$sql = "INSERT INTO wp_postmeta VALUES ('','" . $ticket_id . "','_ticket_hash','" . $hash_val . "')";
mysql_query($sql);
}


add_action('new_ticket', 'apply_hash', 0, 1);

add_action('new_ticket', 'woo_supportpress_email_new_ticket_a', 1, 1);
add_action('new_ticket', 'woo_supportpress_email_owner_of_new_ticket_a', 1, 1);
add_action('new_ticket', 'woo_supportpress_email_assigned_to_new_ticket_a', 1, 1);


add_action('new_message', 'woo_supportpress_email_new_message_a', 1, 1);
add_action('ticket_updated', 'woo_supportpress_email_updated_ticket_a', 1, 3);

/*-----------------------------------------------------------------------------------*/
/* Updated ticket Notice
/*-----------------------------------------------------------------------------------*/

function woo_supportpress_email_updated_ticket_a( $ticket_id, $updates = array(), $comment_id = '' ) {

global $wpdb, $post;

$ticket = get_post($ticket_id);
$auth_id = $ticket->post_author;
$user = new WP_User($auth_id);

if ($user->display_name !='') :
$display_name = $user->display_name;
else :
$display_name = __('Guest', 'woothemes');
endif;

$comment = get_comment( $comment_id );
if ($comment->comment_content && $comment->comment_content!=='[UPDATE]') $comment_content = "\n\n".__('Comment', 'woothemes').":\n\n<quote>" . wptexturize(strip_tags($comment->comment_content)) . "</quote>"; else $comment_content = '';

$subject = '#' . map_ticket_to_hash($ticket_id) . ' [' . get_bloginfo('name'). '] ' . __('Ticket Updated', 'woothemes');
$content = __("Hi there,\n\nTicket #%s has been updated by &ldquo;%s&rdquo;. To view this ticket click the link below:\n\n%s\n\nTicket updates: %s%s\n\nRegards,\n%s", 'woothemes');

$email_content = sprintf(
$content
, $ticket->ID
, $display_name
, '<a href="'.get_permalink($ticket->ID).'">'.$ticket->post_title.'</a>'
, implode(', ', $updates)
, $comment_content
, get_bloginfo('name')
);

// Send notification to users watching the ticket
$watchers = woo_supportpress_get_item_watchers( $ticket->ID );

// Email admin if no-one is assigned
if (!get_post_meta( $ticket->ID, '_responsible', true)) $watchers[] = get_option('admin_email');

if (sizeof($watchers)>0) woo_supportpress_send_mail( $watchers, $subject, $email_content );
}


/*-----------------------------------------------------------------------------------*/
/* New Message Notice
/*-----------------------------------------------------------------------------------*/

function woo_supportpress_email_new_message_a( $item_id ) {

$ticket = get_post($ticket_id);
$auth_id = $ticket->post_author;
$user = new WP_User($auth_id);

if ($user->display_name !='') :
$display_name = $user->display_name;
else :
$display_name = __('Guest', 'woothemes');
endif;

// Send new item notification to admin
$subject = '#' . map_ticket_to_hash($item_id) . ' [' . get_bloginfo('name'). '] ' . __('New Message', 'woothemes');
$content = __("Hi there,\n\nA new message has been submitted by &ldquo;%s&rdquo;. To view this message click the link below:\n\n%s\n\nRegards,\n%s", 'woothemes');

$email_content = sprintf(
$content
, $display_name
, '<a href="'.get_permalink($item->ID).'">'.$item->post_title.'</a>'
, get_bloginfo('name')
);

woo_supportpress_send_mail( woo_supportpress_send_to( 'message' ), $subject, $email_content );
}



function woo_supportpress_email_commented_item_a( $comment_id ) {

global $wpdb, $post, $ticket_updated;

if ($ticket_updated) return;

$comment = get_comment( $comment_id );
$item = get_post($comment->comment_post_ID);

if ($item->post_type!=='ticket' && $item->post_type!=='message') return;

$comment_content = "\n\n".__('Comment', 'woothemes').":\n\n<quote>" . wptexturize(strip_tags($comment->comment_content)) . "</quote>";

if ($comment->user_id > 0) :
$user = new WP_User(get_current_user_id());
$display_name = $user->display_name;
else :
$display_name = $comment->comment_author;
endif;

if ($item->post_type=='ticket') :
$content = __("Hi there,\n\nTicket #%s has been commented on by &ldquo;%s&rdquo;. To view this ticket click the link below:\n\n%s%s\n\nRegards,\n%s", 'woothemes');

$email_content = sprintf(
$content
, $item->ID
, $display_name
, '<a href="'.get_permalink($item->ID).'">'.$item->post_title.'</a>'
, $comment_content
, get_bloginfo('name')
);
else :
$content = __("Hi there,\n\nA message you are watching has been commented on by &ldquo;%s&rdquo;. To view this message click the link below:\n\n%s%s\n\nRegards,\n%s", 'woothemes');

$email_content = sprintf(
$content
, $display_name
, '<a href="'.get_permalink($item->ID).'">'.$item->post_title.'</a>'
, $comment_content
, get_bloginfo('name')
);
endif;

$subject = '#' . map_ticket_to_hash($comment->comment_post_ID) . ' [' . get_bloginfo('name'). '] ' . __('Comment on watched item', 'woothemes');

// Send notification to users watching the ticket
$watchers = woo_supportpress_get_item_watchers( $item->ID );

if (sizeof($watchers)>0) woo_supportpress_send_mail( $watchers, $subject, $email_content );
}

add_action ('comment_post', 'woo_supportpress_email_commented_item_a', 2);

function custom_moderation_subject($subject, $comment_id) {

$site_title = get_bloginfo();
$co = get_comment($comment_id);
return "[ #" . map_ticket_to_hash($co->comment_post_ID) . " ] - $subject";

}


Giri comments:

Hey there,

Actually the plugins checks wp_users table for email.. So are you sure you have the correct email address in Users -> All users -> email column ?


Creativira comments:

Yes, I have the same email address in Users > All Users as I send the email from my email program.


Creativira comments:

This is another file that contains 'mail_registration_needed'
class.supportobject.php
<?php


class SupportObject {

//global uploads;

private $_to;
private $_delivered_to;
private $_from;
private $_subject;
private $_text;
private $_html;
private $_attachments;
private $_attachment_denied;

private $_ticket_id;
private $_owner;
private $_files;


function __construct()
{
$_files = array();
$_attachments = array();
} // function

function init(){

}

function loadObject($Parser){
$this->_to = $Parser->getHeader('to');
$this->_delivered_to = $Parser->getHeader('delivered-to');
$this->_from = $this->getOwnerEmail($Parser->getHeader('from'));
$this->_owner = $this->setOwnerID($this->_from);
//echo "OWNER:".$this->_from;
$this->_subject = $Parser->getHeader('subject');
$this->_text = $Parser->getMessageBody('text');
$this->_html = $Parser->getMessageBody('html');
$this->_attachments = $Parser->getAttachments();
$this->_ticket_id = $this->getTicketID();
echo 'tixid:' . $this->_ticket_id;
$this->parseAttachments();
return true;
}

function saveObject() {


$posted = array();

if($this->_owner > 0 && ($this->_ticket_id == 0 || $this->_ticket_id < 0)) {

if($this->getText() != '')
$comment_txt = $this->getText();
else
$comment_txt = $this->getHtml();

$posted['title'] = mb_decode_mimeheader($this->getSubject());
$posted['comment'] = mb_decode_mimeheader($comment_txt);
$posted['ticket_type'] = DEFAULT_TICKET_TYPE;
$posted['priority'] = DEFAULT_EMAIL_PRI;
$posted['responsible'] = DEFAULT_RESPONSIBILITY;
$posted['status'] = DEFAULT_TICKET_STATUS;
$posted['ticket_owner'] = $this->_owner;
$posted['tags'] = DEFAULT_EMAIL_TAGS ;

if( function_exists(woo_supportpress_process_new_ticket) ) {
$return = $this->woo_supportpress_process_new_ticket_pipe($posted,$_attachment_files);
}
if ( is_wp_error($return) )
echo '<div class="notice red delete"><span><p>'.$return->get_error_message().'</p></span></div>';//}

$_ticket_number = $return;

if($return > 0)
$_is_new_ticket_inserted =true;
else
$_is_new_ticket_inserted = false;

return $_is_new_ticket_inserted;

}

else if($this->_owner > 0)
//Is comment
{

$time = current_time('mysql');

$tick_mapped = $this->map_hash_to_ticket($this->_ticket_id);

if($tick_mapped >0 ) {

if ($this->getText() != '')
$comment_txt = $this->getText();
else
$comment_txt = $this->getHtml();

$comment_data = array(
'comment_post_ID' =>$tick_mapped,
'comment_author' => $this->getOwner()->user_login,
'comment_author_email' => $this->getOwner()->user_email,
'comment_author_url' => '',
'comment_content' => mb_decode_mimeheader($comment_txt),
'comment_type' => '',
'comment_parent' => 0,
'user_id' => 1,
'comment_author_IP' => '127.0.0.1',
'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
'comment_date' => $time,
'comment_approved' => 1
);



$comment_id = wp_insert_comment($comment_data);
do_action('comment_post', $comment_id, $commentdata['comment_approved']);


$this->add_attachment_meta($this->getFiles(),$uploads,$tick_mapped,$this->_owner);
}
if($comment_id > 0)
return true;
else
return false;

}

}

function getTo()
{
return $this->_to;
}
function getDeliveredTo()
{
return $this->_delivered_to;
}

function getFrom()
{
return $this->_from;
}
function getSubject()
{
return $this->_subject;
}

function getText()
{
return $this->_text;
}
function getHtml()
{
return $this->_html;
}

function getFiles()
{
if(isset($this->_files))
return $this->_files;
else
return array();
}

function parseAttachments()
{

$i=0;
$files=array();

global $uploads;
$uploads = wp_upload_dir();
foreach($this->_attachments as $attachment) {

$tmp_name = rand(1, 500);

// get the attachment name
$filename = mb_decode_mimeheader($attachment->getFilename());

$filen=$this->sanitize($tmp_name .'_'. $filename .'.'. end(explode(".", $filename)), true);
$abs_file_path = $uploads['path'].'/' . $filen;

// write the file to the directory you want to save it in
if ($fp = fopen($abs_file_path, 'w')) {
while($bytes = $attachment->read()) {
fwrite($fp, $bytes);
}
fclose($fp);
}

$files[$i] = array();

$files[$i]['filename'] = $filen;
$files[$i]['name'] = $abs_file_path;
$files[$i]['type'] = $attachment->getContentType();
$files[$i]['tmpname'] = $filen;
$files[$i]['error'] = '';
$files[$i]['size'] = $byte_sz;

$i++;

}

$this->_files = $files;


}

function ifFilesAttached(){

if(isset($_attachments))
return true;
else
return false;
}

function getOwner()
{
$o = get_userdata($this->getOwnerID());
return $o;
}


function getOwnerID()
{
return $this->_owner;
}

function getOwnerEmail($email)
{

//if($_owner >0)
if ($email != '')
{
$emails= $this->extract_emails_from($email);

return $emails[0];
}
else

return -1;


}

//Modifier

function checkOwnerID($user_id)
{
global $wpdb;

$count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->users WHERE ID = '$user_ID'"));

if($count == 1){ return true; }else{ return false; }
}

function setOwnerID($email) {

global $wpdb;
$from_addr = $email;
$wp_user_id = $wpdb->get_var("SELECT id FROM wp_users where user_email='" . $from_addr . "'");

//echo'yag:'.$wp_user_id;

return $wp_user_id;


}

function getTicketID() {
//echo "test";
$ticket_num = $this->detect_ticket_number($this->_subject);
//if($ticket_num >0 && $this->is_real_post($ticket_num))
// {
return $ticket_num;
//}else
// return -1;

}

function detect_ticket_number($subject) {

$ticket_number = -1;
/*preg_match_all("/\d+/", $subject, $text_nums);
$ticket_number = $text_nums[0][0];
*/

$rightofhash = explode('#',$subject);
$leftside = explode(' ',$rightofhash[1]);

$ticket_number =$leftside[0];

if($ticket_number =='')
$ticket_number = -1;

return $ticket_number;

}

function get_user_id_by_email($from) {
//todo: verify email formatting

}



function woo_supportpress_process_new_ticket_pipe($posted,$files) {
global $wpdb;
global $uploads;
$errors = new WP_Error();


/* Validate Requried Fields */
if (empty($posted['title'])) $errors->add('required-field', __('<strong>Error</strong> &ldquo;Title&rdquo; is a required field.', 'woothemes'));
if (empty($posted['comment'])) $errors->add('required-field', __('<strong>Error</strong> Please describe the problem.', 'woothemes'));

if (sizeof($errors->errors)>0) return $errors;

/* Author */
if ($posted['ticket_owner']>0) $post_author = $posted['ticket_owner']; else $post_author = get_current_user_id();

/* Create ticket */

$data = array(
'post_content' => $wpdb->escape($posted['comment']),
'post_title' => $wpdb->escape($posted['title']),
'post_status' => 'publish',
'post_author' => $post_author,
'post_type' => 'ticket'
);

$ticket_id = wp_insert_post($data);


$this->_ticket_id = $ticket_id;
if ($ticket_id==0 || is_wp_error($ticket_id)) wp_die( __('Error: Unable to create ticket.', 'woothemes') );

/* Set terms */

$terms = array();
if ($posted['priority']) $terms[] = get_term_by( 'id', $posted['priority'], 'ticket_priority')->slug;
if (sizeof($terms)>0) wp_set_object_terms($ticket_id, $terms, 'ticket_priority');

wp_set_object_terms($ticket_id, array(NEW_STATUS_SLUG), 'ticket_status');

/* Type */

$terms = array();
if ($posted['ticket_type']) $terms[] = get_term_by( 'id', $posted['ticket_type'], 'ticket_type')->slug;
if (sizeof($terms)>0) wp_set_object_terms($ticket_id, $terms, 'ticket_type');

/* Responsible */

if ($posted['responsible'] && $posted['responsible']>0) :
update_post_meta($ticket_id, '_responsible', $posted['responsible']);
else :
update_post_meta($ticket_id, '_responsible', '');
endif;

/* Status */

$terms = array();
if ($posted['status']) $terms[] = get_term_by( 'id', $posted['status'], 'ticket_status')->slug;
if (sizeof($terms)>0) wp_set_object_terms($ticket_id, $terms, 'ticket_status');

/* Tags */

if (isset($posted['tags']) && $posted['tags']) :

$tags = explode(',', trim(stripslashes($posted['tags'])));
$tags = array_map('strtolower', $tags);
$tags = array_map('trim', $tags);

if (sizeof($tags)>0) :
wp_set_object_terms($ticket_id, $tags, 'ticket_tags');
endif;

endif;

/* Attach file to ticket */

$this->add_attachment_meta($this->getFiles(),$uploads,$ticket_id,$this->_owner);

do_action('new_ticket', $ticket_id);
/* Attach file to ticket */

/* Successful, return ticket */
return $ticket_id;



}

function extract_emails_from($string){
$matches = array();
preg_match_all("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $string, $matches);
return $matches[0];
}

function sanitize($string = '', $is_filename = FALSE)
{
// Replace all weird characters with dashes
$string = preg_replace('/[^\w\-'. ($is_filename ? '~_\.' : ''). ']+/u', '-', $string);

// Only allow one dash separator at a time (and make string lowercase)
return mb_strtolower(preg_replace('/--+/u', '-', $string), 'UTF-8');
}



function add_attachment_meta($files_loaded,$uploads,$parent,$owner) {
$opt = get_option('email_reply_options');
global $uploads;
if ($files_loaded) :

if(isset($opt['allow_attachments'])) {

foreach ($files_loaded as $attachment){
$attachment_data = array(
'post_mime_type' => $attachment['type'],
'post_title' => preg_replace('/\.[^.]+$/', '', basename($attachment['filename'])),
'post_content' => '',
'post_status' => 'inherit',
'post_author' => $owner
);

//remove starting slash from upload path
$uploads_relative = substr($uploads['subdir'] .'/'. $attachment['filename'], 1);
$attachment_id = wp_insert_attachment( $attachment_data, $uploads_relative, $parent );
$attachment_metadata = wp_generate_attachment_metadata( $attachment_id, $attachment['name'] );
wp_update_attachment_metadata( $attachment_id, $attachment_metadata );

}
$this->_attachment_denied = false;
}
else
{
$this->_attachment_denied = true;

}
endif;
}


function mail_created_success()
{

$to = $this->getFrom();
//wp_mail($to, 'Ticket Successfully Created #' . $this->getTicketID(), '<p>Thank you for contacting us. This is an automated response confirming the receipt of your ticket. One of our agents will get back to you as soon as possible. For your records, the details of the ticket are listed below. When replying, please make sure that the ticket ID is kept in the subject line to ensure that your replies are tracked appropriately.</p>');


}

function mail_registration_needed()
{

$to = $this->getFrom();
wp_mail($to, 'Registration Required', '<p>I am Sorry.You must register at <a href="' . get_bloginfo('siteurl') . '/wp-login.php?action=register">' . get_bloginfo('siteurl') .'</a> to submit a trouble ticket</p>');

}




function mail_attachments_not_allowed() {

$user_info = get_userdata($this->_owner);
wp_mail($user_info->user_email, 'Attachments are not allowed at this time','<p>I am sorry, Email attachments are not currently supported. Please visit your ticket at ' . post_permalink($this->_ticket_id) . ' to send a file to the support team</p>');



}

function is_real_post($ticket_num) {

global $wpdb;
$sql ="SELECT ID FROM wp_posts WHERE ID='" . $ticket_num ."'";
$num = $wpdb->get_var($sql);

if($num == $ticket_num)
return true;
else
return false;

}

function map_hash_to_ticket($hash) {
global $wpdb;
$hash_stripped = mysql_real_escape_string($hash);
$sql = "SELECT post_id FROM wp_postmeta WHERE meta_key = '_ticket_hash' and meta_value = '" . $hash_stripped . "'";
error_log($sql . "TICKET:" . $hash);

$post_id = $wpdb->get_var($sql);
if($post_id != 0)
return $post_id;
else
return false;
}
function map_ticket_to_hash($ticket_id) {

$ticket_id = get_post_meta($ticket_id, '_ticket_hash');

if($ticket_id != '' || $ticket != '0')
return $ticket_id;
else
return false;

}


function isRegNeeded()
{
if($this->_owner ==0 || $this->_owner < 0) {
return true;
}
else
{
return false;
}
}

function unauthorizedAttachments()
{
if(isset($this->_attachments) && $this->_attachment_denied ==true) {
return true;
}
else
{
return false;
}
}


//class
}


?>


Giri comments:

Ok could you modify this function like this and test again. ?

I want you to replace
function setOwnerID($email) {
global $wpdb;
$from_addr = $email;
$wp_user_id = $wpdb->get_var("SELECT id FROM wp_users where user_email='" . $from_addr . "'");
return $wp_user_id;
}


with


function setOwnerID($email) {
global $wpdb;
$from_addr = $email;
$wp_user_id = $wpdb->get_var("SELECT id FROM wp_users where user_email='" . $from_addr . "'");
error_log("Your wp user id is $wp_user_id", 1,$email);
return $wp_user_id;
}


Once you replaced the code test again. You will get an email with subject like "Your wp user id is xx" . Just let me know the user id. I just want to make sure whether it is a valid user id or not.


Creativira comments:

I've changed the function as you instructed; not getting the ID message. Getting the same email without the message you described.


Giri comments:

Did you check your spam folder?


Creativira comments:

I am getting an email, yes, without the wp user id message. (spam box checked)


Giri comments:

I'm not really sure the problem you have.. Can you send me your ftp details via message from my profile?

http://www.wpquestions.com/user/profile/id/4567

I'll check whats wrong..


Creativira comments:

Sent. Thank you.


Giri comments:

Ok.


Creativira comments:

You ROCK. Thank you!