本文整理汇总了PHP中e107::getEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getEmail方法的具体用法?PHP e107::getEmail怎么用?PHP e107::getEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getEmail方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unanswered
function unanswered()
{
$sql = e107::getDb();
$tp = e107::getParser();
$limit = 25;
$count = $sql->retrieve('faqs', 'faq_id', "faq_answer='' ", true);
$existing = $sql->retrieve('faqs', 'faq_id,faq_question,faq_datestamp', "faq_answer='' ORDER BY faq_datestamp DESC LIMIT " . $limit, true);
if (empty($existing)) {
return;
}
$questions = array();
foreach ($existing as $row) {
$questions[] = "<i>" . $row['faq_question'] . "</i><br /><small>" . $tp->toDate($row['faq_datestamp'], 'short') . "</small>\n";
// $questions[] = $row['faq_question'];
}
//
// $questions = array( "<i>Test Question</i><br /><small>".$tp->toDate(time(),'short')."</small>");
$name = SITENAME . " Automation";
$email = e107::pref('core', 'siteadminemail');
$name = e107::pref('core', 'siteadmin');
$link = $tp->replaceConstants("{e_PLUGIN}faqs/admin_config.php?mode=main&action=list&filter=pending", 'full');
$body = "<h2>" . count($count) . " Unuanswered Questions at " . SITENAME . "</h2>To answer these questions, please login to " . SITENAME . " and then <a href='{$link}'>click here</a>.<br />\n\t\t\tThe " . $limit . " most recent questions are displayed below.\n\t\t\t<ul><li>" . implode("</li><li>", $questions) . "</li></ul>";
$eml = array('subject' => count($count) . " Unuanswered Question as of " . date('d-M-Y') . " ", 'sender_name' => SITENAME . " Automation", 'html' => true, 'template' => 'default', 'body' => $body);
e107::getEmail()->sendEmail($email, $name, $eml);
}
示例2: previewPage
/**
* Preview the Email.
*/
function previewPage($id = '', $user = null)
{
if (is_numeric($id)) {
$mailData = e107::getDb()->retrieve('mail_content', '*', 'mail_source_id=' . intval($id) . " LIMIT 1");
$shortcodes = array('USERNAME' => 'John Example', 'DISPLAYNAME' => 'John Example', 'USERID' => '555', 'MAILREF' => $_GET['id'], 'LOGINNAME' => 'johnE', 'ACTIVATION_LINK' => SITEURL . 'signup.php?testing-activation', 'PASSWORD' => 'MyPass123', 'NEWSLETTER' => SITEURL . "newsletter/?id=example1234567", 'UNSUBSCRIBE' => SITEURL . "unsubscribe/?id=example1234567");
if (!empty($user)) {
$userData = e107::getDb()->retrieve('mail_recipients', '*', 'mail_detail_id = ' . intval($id) . ' AND mail_recipient_id = ' . intval($user) . ' LIMIT 1');
$shortcodes = e107::unserialize(stripslashes($userData['mail_target_info']));
}
$data = $this->mailAdmin->dbToMail($mailData);
$eml = array('subject' => $data['mail_subject'], 'body' => $data['mail_body'], 'template' => $data['mail_send_style'], 'shortcodes' => $shortcodes, 'media' => $data['mail_media']);
// return print_a($data,true);
} else {
// e107::coreLan('signup');
$tp = e107::getParser();
$eml = array('subject' => 'Test Subject', 'body' => "This is the body text of your email. Included are example media attachments such as images and video thumbnails.<br /></br >Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed aliquam volutpat risus, a efficitur ex dignissim ac. Phasellus ornare tortor est, a elementum orci finibus non! Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce feugiat bibendum venenatis. Ut sit amet purus id magna consequat euismod vitae ac elit. Maecenas rutrum nisi metus, sed pulvinar velit fermentum eu? Aliquam erat volutpat.<br />\n\t\t\t\t\t\t\t\t\tUt risus massa, consequat et gravida vitae, tincidunt in metus. Nam sodales felis non tortor faucibus lacinia! Integer neque libero, maximus eu cursus nec, fringilla varius erat. Phasellus elementum scelerisque mauris at fermentum. Aliquam erat volutpat. Aliquam sit amet placerat leo, vitae mollis purus. Nulla laoreet nulla pretium risus placerat, a luctus risus pulvinar. Duis ut dolor sed arcu aliquam dictum sed auctor magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Etiam eleifend in mi lobortis blandit. Aliquam vestibulum rhoncus vestibulum. Cras metus.", 'template' => $id, 'shortcodes' => $this->getExampleShortcodes(), 'media' => array(0 => array('path' => '{e_PLUGIN}gallery/images/butterfly.jpg'), 1 => array('path' => 'h-v880sXEOQ.youtube'), 2 => array('path' => '_j0b9syAuIk.youtube'), 3 => array('path' => '{e_PLUGIN}gallery/images/horse.jpg'), 4 => array('path' => '{e_PLUGIN}gallery/images/lake-and-forest.jpg')));
}
return e107::getEmail()->preview($eml);
exit;
}
示例3: email
/**
* Send user email
* @param mixed $userInfo array data or null for current logged in user or any object subclass of e_object (@see e_system_user::renderEmail() for field requirements)
*/
public function email($type = 'email', $options = array(), $userInfo = null)
{
if (null === $userInfo) {
$userInfo = $this->getData();
} elseif (is_object($userInfo) && get_class($userInfo) == 'e_object' || is_subclass_of($userInfo, 'e_object')) {
$userInfo = $userInfo->getData();
}
if (empty($userInfo) || !vartrue($userInfo['user_email'])) {
return false;
}
// plain password could be passed only via $options
unset($userInfo['user_password']);
if ($options && is_array($options)) {
$userInfo = array_merge($options, $userInfo);
}
$eml = $this->renderEmail($type, $userInfo);
if (empty($eml)) {
if ($this->debug) {
echo '$eml returned nothing on Line 1050 of user_model.php using $type = ' . $type;
print_a($userInfo);
}
return false;
} else {
if ($this->debug) {
echo '<h3>$eml array</h3>';
print_a($eml);
}
}
$mailer = e107::getEmail();
$mailer->template = $eml['template'];
// Custom e107 Header
if ($userInfo['user_id']) {
$eml['e107_header'] = $userInfo['user_id'];
// $mailer->AddCustomHeader("X-e107-id: {$userInfo['user_id']}");
}
if (getperms('0') && E107_DEBUG_LEVEL > 0) {
e107::getMessage()->addDebug("Email Debugger active. <b>Simulation Only!</b>");
e107::getMessage()->addDebug($mailer->preview($eml));
return true;
}
return $mailer->sendEmail($userInfo['user_email'], $userInfo['user_name'], $eml, false);
}
示例4: sendEmailPreview
private function sendEmailPreview()
{
$temp = array();
$eml = $this->render_email($temp, TRUE);
// It ignores the data, anyway
$mailer = e107::getEmail();
if (!$mailer->sendEmail(USEREMAIL, USERNAME, $eml, FALSE)) {
echo "<div class='alert alert-danger'>" . LAN_SIGNUP_42 . "</div>";
// there was a problem.
} else {
echo "<div class='alert alert-success'>" . LAN_SIGNUP_43 . " [ " . USEREMAIL . " ] - " . LAN_SIGNUP_45 . "</div>";
}
}
示例5: array
}
$body .= "</table>";
if (!empty($CONTACT_EMAIL['subject'])) {
$vars = array('CONTACT_SUBJECT' => $subject, 'CONTACT_PERSON' => $send_to_name);
if (!empty($_POST)) {
foreach ($_POST as $k => $v) {
$scKey = strtoupper($k);
$vars[$scKey] = $tp->toEmail($v, true, 'RAWTEXT');
}
}
$subject = $tp->simpleParse($CONTACT_EMAIL['subject'], $vars);
}
// -----------------------
// Send as default sender to avoid spam issues. Use 'replyto' instead.
$eml = array('subject' => $subject, 'sender_name' => $sender_name, 'body' => $body, 'replyto' => $sender, 'replytonames' => $sender_name, 'template' => 'default');
$message = e107::getEmail()->sendEmail($send_to, $send_to_name, $eml, false) ? LANCONTACT_09 : LANCONTACT_10;
// $message = (sendemail($send_to,"[".SITENAME."] ".$subject, $body,$send_to_name,$sender,$sender_name)) ? LANCONTACT_09 : LANCONTACT_10;
if (isset($pref['contact_emailcopy']) && $pref['contact_emailcopy'] && $email_copy == 1) {
require_once e_HANDLER . "mail.php";
sendemail($sender, "[" . SITENAME . "] " . $subject, $body, ADMIN, $sender, $sender_name);
}
$ns->tablerender('', "<div class='alert alert-success'>" . $message . "</div>");
require_once FOOTERF;
exit;
} else {
message_handler("P_ALERT", $error);
}
}
if (SITECONTACTINFO) {
if (!isset($CONTACT_INFO)) {
$CONTACT_INFO = e107::getCoreTemplate('contact', 'info');
示例6: email
/**
* Send user email
* @param mixed $userInfo array data or null for current logged in user or any object subclass of e_object (@see e_system_user::renderEmail() for field requirements)
*/
public function email($type = 'default', $options = array(), $userInfo = null)
{
if (null === $userInfo) {
$userInfo = $this->getData();
} elseif (is_object($userInfo) && get_class($userInfo) == 'e_object' || is_subclass_of($userInfo, 'e_object')) {
$userInfo = $userInfo->getData();
}
if (empty($userInfo) || !vartrue($userInfo['user_email'])) {
return false;
}
if ($options && is_array($options)) {
$userInfo = array_merge($options, $userInfo);
}
$eml = $this->renderEmail($userInfo, $type);
if (empty($eml)) {
return false;
}
$mailer = e107::getEmail();
return $mailer->sendEmail($userInfo['user_email'], $userInfo['user_name'], $eml, false);
}
示例7: sendNextEmail
//.........这里部分代码省略.........
$mailToSend = $this->makeEmailBlock($email);
// Substitute mail-specific variables, attachments etc
if ($this->debugMode) {
echo "<h3>Preview</h3>";
$preview = $this->mailer->preview($mailToSend);
echo $preview;
echo "<h3>Preview (HTML)</h3>";
print_a($preview);
$logName = "mailout_simulation_" . $email['mail_source_id'];
e107::getLog()->addDebug("Sending Email to <" . $email['mail_recipient_name'] . "> " . $email['mail_recipient_email'])->toFile($logName, 'Mailout Simulation Log', true);
$result = true;
$this->mailer->setDebug(true);
echo "<h2>SendEmail()->Body</h2>";
print_a($this->mailer->Body);
echo "<h2>SendEmail()->AltBody</h2>";
print_a($this->mailer->AltBody);
echo "<h1>_________________________________________________________________________</h1>";
return;
}
$result = $this->mailer->sendEmail($email['mail_recipient_email'], $email['mail_recipient_name'], $mailToSend, TRUE);
if ($this->debugMode) {
return true;
}
// Try and send
// return; // ************************************************** Temporarily stop DB being updated when line active *****************************
$addons = array_keys($email['mail_selectors']);
// trigger e_mailout.php addons. 'sent' method.
foreach ($addons as $plug) {
if ($plug === 'core') {
continue;
}
if ($cls = e107::getAddon($plug, 'e_mailout')) {
$email['status'] = $result;
if (e107::callMethod($cls, 'sent', $email) === false) {
e107::getAdminLog()->add($plug . ' sent process failed', $email, E_LOG_FATAL, 'SENT');
}
}
}
// --------------------------
$this->checkDB(2);
// Make sure DB object created
// Now update email status in DB. We just create new arrays of changed data
if ($result === TRUE) {
// Success!
$targetData['mail_status'] = MAIL_STATUS_SENT;
$targetData['mail_send_date'] = time();
$this->currentBatchInfo['mail_togo_count']--;
$this->currentBatchInfo['mail_sent_count']++;
} else {
// Failure
// If fail and still retries, downgrade priority
if ($targetData['mail_status'] > MAIL_STATUS_PENDING) {
$targetData['mail_status'] = max($targetData['mail_status'] - 1, MAIL_STATUS_PENDING);
// One off retry count
$targetData['mail_e107_priority'] = max($email['mail_e107_priority'] - 1, 1);
// Downgrade priority to avoid clag-ups
} else {
$targetData['mail_status'] = MAIL_STATUS_FAILED;
$this->currentBatchInfo['mail_togo_count'] = max($this->currentBatchInfo['mail_togo_count'] - 1, 0);
$this->currentBatchInfo['mail_fail_count']++;
$targetData['mail_send_date'] = time();
}
}
if (isset($this->currentBatchInfo['mail_togo_count']) && $this->currentBatchInfo['mail_togo_count'] == 0) {
$this->currentBatchInfo['mail_end_send'] = time();
$this->currentBatchInfo['mail_content_status'] = MAIL_STATUS_SENT;
}
// Update DB record, mail record with status (if changed). Must use different sql object
if (count($targetData)) {
//print_a($targetData);
$this->db2->update('mail_recipients', array('data' => $targetData, '_FIELD_TYPES' => $this->dbTypes['mail_recipients'], 'WHERE' => '`mail_target_id` = ' . intval($email['mail_target_id'])));
}
if (count($this->currentBatchInfo)) {
//print_a($this->currentBatchInfo);
$this->db2->update('mail_content', array('data' => $this->currentBatchInfo, '_FIELD_TYPES' => $this->dbTypes['mail_content'], 'WHERE' => '`mail_source_id` = ' . intval($email['mail_source_id'])));
}
if ($this->currentBatchInfo['mail_togo_count'] == 0 && $email['mail_notify_complete'] > 0) {
$email = array_merge($email, $this->currentBatchInfo);
// This should ensure the counters are up to date
$mailInfo = LAN_MAILOUT_247 . '<br />' . LAN_TITLE . ': ' . $email['mail_title'] . '<br />' . LAN_MAILOUT_248 . $this->statusToText($email['mail_content_status']) . '<br />';
$mailInfo .= '<br />' . LAN_MAILOUT_249 . '<br />';
foreach ($this->mailCountFields as $f => $t) {
$mailInfo .= $t . ' => ' . $email[$f] . '<br />';
}
$mailInfo .= LAN_MAILOUT_250;
$message = array('mail_subject' => LAN_MAILOUT_244 . $email['mail_subject'], 'mail_body' => $mailInfo . '<br />');
if ($email['mail_notify_complete'] & 1) {
if ($this->db2->select('user', 'user_name, user_email', '`user_id`=' . intval($email['mail_creator']))) {
$row = $this->db2->fetch();
e107::getEmail()->sendEmail($row['user_name'], $row['user_email'], $message, FALSE);
}
}
if ($email['mail_notify_complete'] & 2) {
require_once e_HANDLER . "notify_class.php";
// notify_maildone($message); // FIXME
}
e107::getEvent()->trigger('maildone', $email);
}
return $result;
}
示例8: sendTest
function sendTest()
{
$log = e107::getAdminLog();
$mes = e107::getMessage();
if (trim($_POST['testaddress']) == '') {
$mes->add(LAN_MAILOUT_19, E_MESSAGE_ERROR);
$subAction = 'error';
} else {
$mailheader_e107id = USERID;
$pref = e107::pref('core');
$add = $pref['mailer'] ? " (" . strtoupper($pref['mailer']) . ")" : ' (PHP)';
$sendto = trim($_POST['testaddress']);
$eml = array();
$eml['email_subject'] = LAN_MAILOUT_113 . " " . SITENAME . $add;
$eml['email_sender_email'] = null;
$eml['email_sender_name'] = null;
$eml['email_replyto'] = null;
$eml['email_replytonames'] = null;
$eml['send_html'] = true;
$eml['add_html_header'] = null;
$eml['email_body'] = str_replace("[br]", "<br>", LAN_MAILOUT_114);
$eml['email_attach'] = null;
$eml['template'] = 'default';
$eml['e107_header'] = USERID;
if (!e107::getEmail()->sendEmail($sendto, LAN_MAILOUT_189, $eml)) {
$mes->addError($pref['mailer'] == 'smtp' ? LAN_MAILOUT_67 : LAN_MAILOUT_106);
} else {
$mes->addSuccess(LAN_MAILOUT_81 . ' (' . $sendto . ')');
$log->log_event('MAIL_01', $sendto, E_LOG_INFORMATIVE, '');
}
}
}
示例9: sendEmail
function sendEmail()
{
global $pref, $_E107;
if ($_E107['debug']) {
echo "<br />sendEmail() executed";
}
// require_once(e_HANDLER.'mail.php');
$message = "Your Cron test worked correctly. Sent on " . date("r") . ".";
$message .= "<h2>Environment Variables</h2>";
$userCon = get_defined_constants(true);
ksort($userCon['user']);
$userVars = array();
foreach ($userCon['user'] as $k => $v) {
if (substr($k, 0, 2) == 'e_') {
$userVars[$k] = $v;
}
}
$message .= "<h3>e107 PATHS</h3>";
$message .= $this->renderTable($userVars);
$message .= "<h3>_SERVER</h3>";
$message .= $this->renderTable($_SERVER);
$message .= "<h3>_ENV</h3>";
$message .= $this->renderTable($_ENV);
$eml = array('subject' => "TEST Email Sent by cron. " . date("r"), 'sender_name' => SITENAME . " Automation", 'html' => true, 'template' => 'default', 'body' => $message);
e107::getEmail()->sendEmail($pref['siteadminemail'], $pref['siteadmin'], $eml);
// sendemail($pref['siteadminemail'], "e107 - TEST Email Sent by cron.".date("r"), $message, $pref['siteadmin'],SITEEMAIL, $pref['siteadmin']);
}
示例10: mailRead
/**
* Read the Mail.
* @param object $iKlimit [optional]
* @return string mail message
*/
function mailRead($iKlimit = 4096)
{
$fp = fopen("php://stdin", "r");
if (!$fp) {
$pref = e107::getPref();
$eml = array('subject' => "Bounce-Handler-Error :", 'sender_email' => $pref['siteadminemail'], 'sender_name' => $pref['siteadmin'], 'html' => true, 'template' => 'default', 'body' => "Error - failed to read mail from STDIN! : " . __FILE__ . " (" . __LINE__ . ")");
e107::getEmail()->sendEmail($pref['siteadminemail'], SITENAME . " :: Bounce-Handler.", $eml);
exit;
}
// Create empty string for storing message
$sEmail = "";
$i_limit = 0;
if ($iKlimit == -1) {
while (!feof($fp)) {
$sEmail .= fread($fp, 1024);
}
} else {
while (!feof($fp) && $i_limit < $iKlimit) {
$sEmail .= fread($fp, 1024);
$i_limit++;
}
}
fclose($fp);
return $sEmail;
}