joomla2.5 对一个组群发邮件
<无详细内容>
$app = JFactory::getApplication(); $acl = JFactory::getACL(); $db = JFactory::getDbo(); $groupId = 10; $uIds = $acl->getUsersByGroup($groupId, false); $query = $db->getQuery(true); $query->select('email'); $query->from('#__users'); $query->where('id IN (' . implode(',', $uIds) . ')'); $query->where("block = 0 AND sendEmail = 1"); $db->setQuery($query); $rows = $db->loadColumn(); $mailer = JFactory::getMailer(); $mailer->setSender(array($app->getCfg('mailfrom'), $app->getCfg('fromname'))); $mailer->setSubject($subject); $mailer->setBody($body); $mailer->IsHTML(true); $mailer->addRecipient($rows); if (!$mailer->Send()) { JError::raiseWarning(500, JText::_('ERROR_SENDING_EMAIL')); }
- 上一篇:excel读取
- 下一篇:PHP图片裁剪、缩放
精彩图集
精彩文章