LOL ... The problem is not creating the link but the fact that it does not recognize the words REPUBLISH_URL and EXPIRE_DAYS despite these being passed as variables in email php file
File emails.php contains:
//Create email when listing is going to expire
EmailVariables::newInstance()->add('{REPUBLISH_URL}', 'Generate complete republish link (not raw, but text with link).');
EmailVariables::newInstance()->add('{EXPIRE_DAYS}', 'In how many days will listing expire.');
then:
$words = array();
$words[] = array('{CONTACT_NAME}', '{ITEM_TITLE}', '{WEB_TITLE}', '{REPUBLISH_URL}', '{EXPIRE_DAYS}', '{ITEM_ID}');
$words[] = array($item['s_contact_name'], stripslashes(strip_tags($item['s_title'])), stripslashes(strip_tags(osc_page_title())), $url, $expire_days, $item['pk_i_id']) ;
All words are recognized in the email but the most important are not converted to actual links or days eg: {REPUBLISH_URL}', '{EXPIRE_DAYS}