5 require_once 'Pman/Roo.php';
7 class Pman_Hydra_Import_Core_email extends Pman_Roo
9 static $cli_desc = "Import an email into core_email template";
11 static $cli_opts = array(
13 'desc' => 'Turn on debugging (see DataObjects debugLevel )',
21 'desc' => 'List message to send, do not send them..',
29 'desc' => 'Show old messages.. (and new messages...)',
37 'desc' => 'Force redelivery, even if it has been sent before or not queued...',
44 'desc' => 'Generate notifications for a table, eg. cash_invoice',
51 'desc' => 'Limit search for no. to send to ',
58 'desc' => 'Dry run - do not send.',
65 'desc' => 'Pool size',
75 $ff = HTML_FlexyFramework::get();
85 $template_name = 'CORE_PERSON_SIGNUP_CONFIRM';
86 $c = DB_dataObject::factory('core_email');
87 $ret = $c->get('name',$template_name);
89 $mailtext = file_get_contents('Pman.Core/templates/mail/'.$template_name.'.txt');
91 require_once 'Mail/mimeDecode.php';
92 $decoder = new Mail_mimeDecode($mailtext);
93 $parts = $decoder->getSendArray();
94 $from_name = explode(" ", $parts[0])[0];
95 $from_email = explode(" ", $parts[0])[1];
97 'from_name'=>$from_name,
98 'from_email'=>$from_email,
99 'subject'=>$parts[1]['Subject'],
100 'name'=>$template_name,
101 'bodytext'=>$parts[2]
105 print_r("template exists.");