my$forum_sql="select * from im_forum_topics where topic_id in (select min(topic_id) as topic_id from im_forum_topics where mime_message_id = '$in_reply_to_email_id')";
$sth=$dbh->prepare($forum_sql);
$sth->execute()||die"import-pop3: Unable to execute SQL statement: \n$forum_sql\n";
# Search for parent with field mime_message_id for in-reply-to:
if($thread_parent_ideq""){
my$forum_sql="select * from im_forum_topics where topic_id in (select min(topic_id) as topic_id from im_forum_topics where mime_message_id = '$in_reply_to_email_id')";
$sth=$dbh->prepare($forum_sql);
$sth->execute()||die"import-pop3: Unable to execute SQL statement: \n$forum_sql\n";
# Search for parent with field exchange_message_id for in-reply-to:
if($thread_parent_ideq""){
my$forum_sql="select * from im_forum_topics where topic_id in (select min(topic_id) as topic_id from im_forum_topics where exchange_message_id = '$in_reply_to_email_id')";
$sth=$dbh->prepare($forum_sql);
$sth->execute()||die"import-pop3: Unable to execute SQL statement: \n$forum_sql\n";