setPageNameIndex (BX_PAGE_DEFAULT); $oTemplate->setPageHeader ("Send Email Example"); $oTemplate->setPageContent ('page_main_code', PageCompMainCode()); $oTemplate->getPageCode(); /** * page code function */ function PageCompMainCode() { ob_start(); bx_import('BxDolAccount'); $oAccount = BxDolAccount::getInstance(); $aAccountInfo = $oAccount ? $oAccount->getInfo() : false; if (!$aAccountInfo) return DesignBoxContent("Send Email example", 'Please login first', BX_DB_PADDING_DEF); echo "

Account info

"; echo "Email: " . $aAccountInfo['email'] . '
'; echo "Email Confirmed: " . ($aAccountInfo['email_confirmed'] ? 'yes' : 'no') . '
'; echo "Receive site updates: " . ($aAccountInfo['receive_updates'] ? 'yes' : 'no') . '
'; echo "Receive site newsletters: " . ($aAccountInfo['receive_news'] ? 'yes' : 'no') . '
'; echo "Site emails are sent from: " . getParam('site_email_notify') . '
'; $a = array ( 'sys' => array ( 'title' => "Send me system email", 'type' => BX_EMAIL_SYSTEM, 'subj' => 'System Email', 'body' => 'This is system email
{unsubscribe}', ), 'notif' => array ( 'title' => "Send me notification", 'type' => BX_EMAIL_NOTIFY, 'subj' => 'Notification Email', 'body' => 'This is notification email
{unsubscribe}', ), 'mass' => array ( 'title' => "Send me bulk email", 'type' => BX_EMAIL_MASS, 'subj' => 'Bulk Email', 'body' => 'This is bulk email
{unsubscribe}', ), ); $sSendMail = bx_get('send'); if ($sSendMail && isset($a[$sSendMail])) { echo "

Send Email Result

"; $r = $a[$sSendMail]; if (sendMail($aAccountInfo['email'], $r['subj'], $r['body'], 0, array(), $r['type'])) echo MsgBox($r['subj'] . ' - successfully sent'); else echo MsgBox($r['subj'] . ' - sent failed'); } echo "

Send email

"; foreach ($a as $k => $r) { echo '' . $r['title'] . '
'; } return DesignBoxContent("Send Email Example", ob_get_clean(), BX_DB_PADDING_DEF); } /** @} */