本文整理汇总了PHP中JMail类的典型用法代码示例。如果您正苦于以下问题:PHP JMail类的具体用法?PHP JMail怎么用?PHP JMail使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JMail类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
// Check for request forgeries
JSession::checkToken() or die('COM_JOOMLEAGUE_GLOBAL_INVALID_TOKEN');
$cid = JRequest::getInt("cid", 0);
$post = JRequest::get('post');
if ($cid > 0) {
$club = JTable::getInstance("Club", "Table");
$club->load($cid);
$club->bind($post);
$params = JComponentHelper::getParams('com_joomleague');
if ($club->store() && $params->get('cfg_edit_club_info_update_notify') == "1") {
$user = JFactory::getUser();
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('u.email');
$query->from('#__users AS u');
$query->leftJoin('#__user_usergroup_map AS map ON map.user_id = u.id');
$query->leftJoin('#__usergroups AS g ON g.id = map.group_id');
$query->where('g.title = ' . $db->quote("Super Users") . ' OR g.title = ' . $db->quote("Administrator"));
$query->order('u.username ASC');
$db->setQuery($query);
$to = $db->loadColumn();
$subject = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_SUBJECT"), $club->name));
$message = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_MESSAGE"), $user->name, $club->name));
$message .= $this->_getShowClubInfoLink();
JMail::sendMail('', '', $to, $subject, $message);
}
}
$this->setRedirect($this->_getShowClubInfoLink());
}
开发者ID:hfmprs,项目名称:JoomLeague,代码行数:31,代码来源:clubinfo.php
示例2: testIsHTML
/**
* Tests the IsHTML method.
*
* @covers JMail::IsHTML
*
* @return void
*/
public function testIsHTML()
{
$returnedObject = $this->object->isHtml(false);
$this->assertThat('text/plain', $this->equalTo($this->object->ContentType));
// Test to ensure that a JMail object is being returned for chaining
$this->assertInstanceOf('JMail', $returnedObject);
}
开发者ID:ZerGabriel,项目名称:joomla-platform,代码行数:14,代码来源:JMailTest.php
示例3: save
public function save()
{
// Check for request forgeries
JSession::checkToken() or die('COM_JOOMLEAGUE_GLOBAL_INVALID_TOKEN');
$cid = JRequest::getInt("cid", 0);
$post = JRequest::get('post');
if ($cid > 0) {
$club =& JTable::getInstance("Club", "Table");
$club->load($cid);
$club->bind($post);
$params = JComponentHelper::getParams('com_joomleague');
if ($club->store() && $params->get('cfg_edit_club_info_update_notify') == "1") {
$db = JFactory::getDbo();
$user = JFactory::getUser();
$query = "SELECT email\n FROM #__users \n WHERE usertype = 'Super Administrator' \n OR usertype = 'Administrator'";
$db->setQuery($query);
$to = $db->loadColumn();
$subject = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_SUBJECT"), $club->name));
$message = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_MESSAGE"), $user->name, $club->name));
$message .= $this->_getShowClubInfoLink();
JMail::sendMail('', '', $to, $subject, $message);
}
}
$this->setRedirect($this->_getShowClubInfoLink());
}
开发者ID:Heart1010,项目名称:JoomLeague,代码行数:25,代码来源:clubinfo.php
示例4: testAddReplyTo
/**
* Tests the addReplyTo method.
*
* @covers JMail::addReplyTo
*
* @return void
*/
public function testAddReplyTo()
{
$recipient = '[email protected]';
$name = 'test_name';
$expected = array('[email protected]' => array('[email protected]', 'test_name'));
$this->object->addReplyTo($recipient, $name);
$this->assertThat($expected, $this->equalTo(TestReflection::getValue($this->object, 'ReplyTo')));
}
开发者ID:nprasath002,项目名称:joomla-platform,代码行数:15,代码来源:JMailTest.php
示例5: set_from
/**
* @param JMail $mail
*/
private function set_from(&$mail)
{
$emailhelper = new FoxEmailHelper($this->Params);
/** @var Joomla\Registry\Registry $config */
$config = JComponentHelper::getParams("com_foxcontact");
// Set a default value
$default = (object) array("select" => "submitter", "email" => "", "name" => "");
$adminemailfrom = $config->get("adminemailfrom", $default);
$from = $emailhelper->convert($adminemailfrom);
$mail->setSender($from);
$adminemailreplyto = $config->get("adminemailreplyto", $default);
$replyto = $emailhelper->convert($adminemailreplyto);
// In Joomla 1.7 From and Reply-to fields is set by default to the Global admin email
// but a call to setSender() won't change the Reply-to field
$mail->ClearReplyTos();
// addReplyTo() function expects an array(address, name) in Joomla 2, and two strings (address, name) in Joomla 3
$mail->addReplyTo($replyto[0], $replyto[1]);
}
开发者ID:HPReflectoR,项目名称:GlavExpert,代码行数:21,代码来源:fadminmailer.php
示例6: send
/**
* @param JMail $mail
* @param array $receivers
*
* @return boolean
*/
public static function send(JMail $mail, array $receivers)
{
$config = KunenaFactory::getConfig();
if (!empty($config->email_recipient_count)) {
$email_recipient_count = $config->email_recipient_count;
} else {
$email_recipient_count = 1;
}
$email_recipient_privacy = $config->get('email_recipient_privacy', 'bcc');
// If we hide email addresses from other users, we need to add TO address to prevent email from becoming spam.
if ($email_recipient_count > 1 && $email_recipient_privacy == 'bcc' && JMailHelper::isEmailAddress($config->get('email_visible_address'))) {
$mail->AddAddress($config->email_visible_address, JMailHelper::cleanAddress($config->board_title));
// Also make sure that email receiver limits are not violated (TO + CC + BCC = limit).
if ($email_recipient_count > 9) {
$email_recipient_count--;
}
}
$chunks = array_chunk($receivers, $email_recipient_count);
$success = true;
foreach ($chunks as $emails) {
if ($email_recipient_count == 1 || $email_recipient_privacy == 'to') {
echo 'TO ';
$mail->ClearAddresses();
$mail->addRecipient($emails);
} elseif ($email_recipient_privacy == 'cc') {
echo 'CC ';
$mail->ClearCCs();
$mail->addCC($emails);
} else {
echo 'BCC ';
$mail->ClearBCCs();
$mail->addBCC($emails);
}
try {
$mail->Send();
} catch (Exception $e) {
$success = false;
JLog::add($e->getMessage(), JLog::ERROR, 'kunena');
}
}
return $success;
}
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:48,代码来源:email.php
示例7: _sendReminderMail
/**
* Sends a username reminder to the e-mail address
* specified containing the specified username.
* @param string A user's e-mail address
* @param string A user's username
* @return bool True on success/false on failure
*/
function _sendReminderMail($email, $username)
{
$config = JFactory::getConfig();
$uri = JFactory::getURI();
$url = $uri->__toString(array('scheme', 'host', 'port')) . JRoute::_('index.php?option=com_user&view=login', false);
$from = $config->getValue('mailfrom');
$fromname = $config->getValue('fromname');
$subject = JText::sprintf('COM_CITRUSCART_CITRUSCART_USER_EMAIL_REMINDER', $config->getValue('sitename'));
$body = JText::sprintf('COM_CITRUSCART_USERNAME_REMINDER_EMAIL_TEXT', $config->getValue('sitename'), $username, $url);
if (!JMail::sendMail($from, $fromname, $email, $subject, $body)) {
$this->setError('COM_CITRUSCART_ERROR_SENDING_REMINDER_EMAIL');
return false;
}
return true;
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:22,代码来源:remind.php
示例8: testIsHtml
/**
* Tests the IsHTML method.
*
* @covers JMail::IsHTML
*
* @return void
*/
public function testIsHtml()
{
$this->object->isHtml(false);
$this->assertThat('text/plain', $this->equalTo($this->object->ContentType));
}
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:12,代码来源:JMailTest.php
示例9: getMailer
function getMailer()
{
if (!FSS_Settings::Get('email_send_override')) {
$mailer = JFactory::getMailer();
$mailer->setSender($this->Get_Sender());
$mailer->CharSet = 'UTF-8';
return $mailer;
}
$smtpauth = FSS_Settings::Get('email_send_smtp_auth') == 0 ? null : 1;
$smtpuser = FSS_Settings::Get('email_send_smtp_username');
// $conf->get('smtpuser');
$smtppass = FSS_Settings::Get('email_send_smtp_password');
// $conf->get('smtppass');
$smtphost = FSS_Settings::Get('email_send_smtp_host');
// $conf->get('smtphost');
$smtpsecure = FSS_Settings::Get('email_send_smtp_security');
// $conf->get('smtpsecure');
$smtpport = FSS_Settings::Get('email_send_smtp_port');
// $conf->get('smtpport');
$mailfrom = FSS_Settings::Get('email_send_from_email');
// $conf->get('mailfrom');
$fromname = FSS_Settings::Get('email_send_from_name');
// $conf->get('fromname');
$mailer = FSS_Settings::Get('email_send_mailer');
// $conf->get('mailer');
// Create a JMail object
$mail = new JMail();
// Set default sender without Reply-to
$mail->SetFrom(JMailHelper::cleanLine($mailfrom), JMailHelper::cleanLine($fromname), 0);
// Default mailer is to use PHP's mail function
switch ($mailer) {
case 'smtp':
$mail->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
break;
case 'sendmail':
$mail->IsSendmail();
break;
default:
$mail->IsMail();
break;
}
$mail->CharSet = 'UTF-8';
return $mail;
}
开发者ID:vstorm83,项目名称:propertease,代码行数:44,代码来源:mailer.php
示例10: _sendMail
function _sendMail(&$user, $password)
{
$input = JFactory::getApplication()->input;
global $mainframe;
$db = JFactory::getDBO();
$name = $user->get('name');
$email = $user->get('email');
$username = $user->get('username');
$usersConfig = JComponentHelper::getParams('com_users');
$sitename = $mainframe->getCfg('sitename');
$useractivation = $usersConfig->get('useractivation');
$mailfrom = $mainframe->getCfg('mailfrom');
$fromname = $mainframe->getCfg('fromname');
$siteURL = JURI::base();
$subject = sprintf(JText::_('COM_CITRUSCART_ACCOUNT_DETAILS_FOR'), $name, $sitename);
$subject = html_entity_decode($subject, ENT_QUOTES);
if ($useractivation == 1) {
$message = sprintf(JText::_('COM_CITRUSCART_SEND_MSG_ACTIVATE'), $name, $sitename, $siteURL . "index.php?option=com_user&task=activate&activation=" . $user->get('activation'), $siteURL, $username, $password);
} else {
$message = sprintf(JText::_('COM_CITRUSCART_SEND_MSG'), $name, $sitename, $siteURL);
}
$message = html_entity_decode($message, ENT_QUOTES);
//get all super administrator
$query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE LOWER( usertype ) = "super administrator"';
$db->setQuery($query);
$rows = $db->loadObjectList();
// Send email to user
if (!$mailfrom || !$fromname) {
$fromname = $rows[0]->name;
$mailfrom = $rows[0]->email;
}
JMail::sendMail($mailfrom, $fromname, $email, $subject, $message);
// Send notification to all administrators
$subject2 = sprintf(JText::_('COM_CITRUSCART_ACCOUNT_DETAILS_FOR'), $name, $sitename);
$subject2 = html_entity_decode($subject2, ENT_QUOTES);
// get superadministrators id
foreach ($rows as $row) {
if ($row->sendEmail) {
$message2 = sprintf(JText::_('COM_CITRUSCART_SEND_MSG_ADMIN'), $row->name, $sitename, $name, $email, $username);
$message2 = html_entity_decode($message2, ENT_QUOTES);
JMail::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
}
}
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:44,代码来源:controller.php
示例11: send
/**
* Send the email
*
* @param JMail $mail Joomla mailer
* @return bool true on success
*/
protected function send(&$mail)
{
if (($error = $mail->Send()) !== true) {
//$info = empty($mail->ErrorInfo) ? $error->getMessage() : $mail->ErrorInfo;
// Obtaining the problem information from Joomla mailer is a nightmare
if (is_object($error)) {
// It is an instance of JError. Calls the getMessage() method
$info = $error->getMessage();
} else {
if (!empty($mail->ErrorInfo)) {
// Send() returned false. If a $mail->ErrorInfo property is set, this is the cause
$info = $mail->ErrorInfo;
} else {
// Send() returned false, but $mail->ErrorInfo is empty. The only reasonable cause can be $mailonline = 0
$info = JText::_("JLIB_MAIL_FUNCTION_OFFLINE");
}
}
$msg = JText::_($GLOBALS["COM_NAME"] . "_ERR_SENDING_MAIL") . ". " . $info;
$this->MessageBoard->Add($msg, FoxMessageBoard::error);
$this->Logger->Write($msg);
//JLog::add($msg, JLog::ERROR, get_class($this));
return false;
}
//JLog::add("Email sent.", JLog::INFO, get_class($this));
return true;
}
开发者ID:HPReflectoR,项目名称:GlavExpert,代码行数:32,代码来源:fdispatcher.php
示例12: createMailer
/**
* Create a mailer object
*
* @return JMail object
*
* @see JMail
* @since 11.1
*/
protected static function createMailer()
{
$conf = self::getConfig();
$smtpauth = $conf->get('smtpauth') == 0 ? null : 1;
$smtpuser = $conf->get('smtpuser');
$smtppass = $conf->get('smtppass');
$smtphost = $conf->get('smtphost');
$smtpsecure = $conf->get('smtpsecure');
$smtpport = $conf->get('smtpport');
$mailfrom = $conf->get('mailfrom');
$fromname = $conf->get('fromname');
$mailer = $conf->get('mailer');
// Create a JMail object
$mail = JMail::getInstance();
// Set default sender without Reply-to
$mail->SetFrom(JMailHelper::cleanLine($mailfrom), JMailHelper::cleanLine($fromname), 0);
// Default mailer is to use PHP's mail function
switch ($mailer) {
case 'smtp':
$mail->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
break;
case 'sendmail':
$mail->IsSendmail();
break;
default:
$mail->IsMail();
break;
}
return $mail;
}
开发者ID:renzhewk,项目名称:joomla-platform,代码行数:38,代码来源:factory.php
示例13: _createMailer
/**
* Create a mailer object
*
* @return JMail object
* @since 11.1
*/
protected static function _createMailer()
{
jimport('joomla.mail.mail');
$conf = self::getConfig();
$sendmail = $conf->get('sendmail');
$smtpauth = $conf->get('smtpauth') == 0 ? null : 1;
$smtpuser = $conf->get('smtpuser');
$smtppass = $conf->get('smtppass');
$smtphost = $conf->get('smtphost');
$smtpsecure = $conf->get('smtpsecure');
$smtpport = $conf->get('smtpport');
$mailfrom = $conf->get('mailfrom');
$fromname = $conf->get('fromname');
$mailer = $conf->get('mailer');
// Create a JMail object
$mail = JMail::getInstance();
// Set default sender
$mail->setSender(array($mailfrom, $fromname));
// Default mailer is to use PHP's mail function
switch ($mailer) {
case 'smtp':
$mail->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
break;
case 'sendmail':
$mail->IsSendmail();
break;
default:
$mail->IsMail();
break;
}
return $mail;
}
开发者ID:ramdesh,项目名称:joomla-platform,代码行数:38,代码来源:factory.php
示例14: juserRegister
public static function juserRegister($juser) {
$result = array();
$oseMscconfig = oseRegistry::call('msc')->getConfig('', 'obj');
$config = JFactory::getConfig();
$params = JComponentHelper::getParams('com_users');
$newUserType = self::getNewUserType($params->get('new_usertype'));
$juser['gid'] = $newUserType;
$data = (array) self::getJuserData($juser);
// Initialise the table with JUser.
$user = new JUser;
foreach ($juser as $k => $v) {
$data[$k] = $v;
}
// Prepare the data for the user object.
$useractivation = $params->get('useractivation');
// Check if the user needs to activate their account.
if (($useractivation == 1) || ($useractivation == 2)) {
jimport('joomla.user.helper');
$data['activation'] = JApplication::getHash(JUserHelper::genRandomPassword());
$data['block'] = 1;
}
// Bind the data.
if (!$user->bind($data)) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError());
}
// Load the users plugin group.
JPluginHelper::importPlugin('user');
if (!$user->save()) {
$result['success'] = false;
$result['title'] = 'Error';
$result['reload'] = ($oseMscconfig->error_registration == 'refresh') ? true : false;
;
$result['content'] = JText::_($user->getError());
} else {
// Mark the user_id in order to user in payment form
if (($useractivation == 1) || ($useractivation == 2)) {
$session = JFactory::getSession();
$oseUser = array();
$oseUser['user_id'] = $user->id;
$oseUser['block'] = true;
$oseUser['activation'] = true;
$session->set('ose_user', $oseUser);
}
$result['success'] = true;
$result['user'] = $user;
$result['title'] = 'Done';
$result['content'] = 'Juser saved successfully';
// Compile the notification mail values.
$data = $user->getProperties();
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$data['siteurl'] = JUri::base();
if (JOOMLA16 == true) {
// Handle account activation/confirmation emails.
if ($useractivation == 2) {
// Set the link to confirm the user email.
$uri = JURI::getInstance();
$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
$data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
$emailSubject = JText::sprintf('COM_USERS_OSEMSC_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
$emailBody = JText::sprintf('COM_USERS_OSEMSC_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY', $data['name'], $data['sitename'],
$data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $data['username'],
$data['password_clear']);
} else if ($useractivation == 1) {
// Set the link to activate the user account.
$uri = JURI::getInstance();
$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
$data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
$emailSubject = JText::sprintf('COM_USERS_OSEMSC_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
$emailBody = JText::sprintf('COM_USERS_OSEMSC_EMAIL_REGISTERED_WITH_ACTIVATION_BODY', $data['name'], $data['sitename'],
$data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $data['username'],
$data['password_clear']);
} else {
$emailSubject = "";
$emailBody = "";
}
// Send the registration email.
if (!empty($emailSubject) && !empty($emailBody)) {
if (JOOMLA30 == true) {
$mailer = new JMail();
$return = $mailer->sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody);
} else {
$return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody);
}
} else {
$return = true;
}
// Check for an error.
if ($return !== true) {
$this->setError(JText::_('COM_USERS_REGISTRATION_SEND_MAIL_FAILED'));
// Send a system message to administrators receiving system mails
$db = JFactory::getDBO();
$q = "SELECT id
FROM #__users
WHERE block = 0
AND sendEmail = 1";
$db->setQuery($q);
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:oseMscPublic.php
示例15: sendEmail
public static function sendEmail($from, $fromName, $replyTo, $toEmail, $cc, $bcc, $subject, $content, $isHtml)
{
jimport('joomla.mail.mail');
$mail = new JMail();
$mail->setSender(array($from, $fromName));
if (isset($replyTo)) {
$mail->addReplyTo($replyTo);
}
$mail->addRecipient($toEmail);
if (isset($cc)) {
$mail->addCC($cc);
}
if (isset($bcc)) {
$mail->addBCC($bcc);
}
$mail->setSubject($subject);
$mail->setBody($content);
$mail->IsHTML($isHtml);
$ret = $mail->send();
$log = Logger::getInstance();
$log->LogDebug("E-mail with subject " . $subject . " sent from " . $from . " to " . $toEmail . " " . serialize($bcc) . " result:" . $ret);
return $ret;
}
开发者ID:benji1979,项目名称:teszt1,代码行数:23,代码来源:EmailService.php
示例16: sendReviewEmail
function sendReviewEmail()
{
$template = "Review Email";
$templ = $this->getEmailTemplate($template);
if ($templ == null) {
return false;
}
$templEmail = $this->prepareEmail($templ->email_content);
//return false;
$config =& JFactory::getConfig();
//$this->itemAppSettings->sendmail_from = $config->get( 'config.mailfrom' );
//$this->itemAppSettings->sendmail_name = $config->get( 'config.fromname' );
$fromName = $this->itemAppSettings->company_name;
//$mainframe->getCfg('fromname');
$confirmEmail = $this->itemAppSettings->company_email;
//$mainframe->getCfg('fromname');
$hotelName = $this->itemHotelSelected->hotel_name;
$templ->email_subject = str_replace(EMAIL_HOTEL_NAME, $hotelName, $templ->email_subject);
$body = $templEmail;
$mode = 1;
//html
$ret = true;
$ret = JMail::sendMail($this->itemAppSettings->company_email, $this->itemAppSettings->company_name, $this->email, $templ->email_subject, $body, $mode);
JHotelReservationModelVariables::writeMessage(" Sending review email to " . $this->email . " result" . $ret);
return $ret;
}
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:26,代码来源:variables.php
示例17: SendMails
function SendMails($userlist, $mailtype)
{
$app = JFactory::getApplication();
$database = JFactory::getDBO();
$mail_from = $app->getCfg('mailfrom');
$site_name = $app->getCfg('sitename');
// If mailfrom is not defined A super administrator is notified
if (!$mail_from || !$site_name) {
//get all super administrator
$query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE LOWER( usertype ) = "super administrator"';
$database->setQuery($query);
$rows = $database->loadObjectList();
$site_name = $rows[0]->name;
$mail_from = $rows[0]->email;
}
set_time_limit(0);
ignore_user_abort();
$mail_body = JTable::getInstance('bidmail');
if (!$mail_body->load($mailtype)) {
return;
}
if (!$mail_body->enabled) {
return;
}
if (!is_array($userlist)) {
if (is_object($userlist)) {
$userlist = array($userlist);
}
}
if (count($userlist) <= 0) {
return;
}
$database->setQuery('SELECT email FROM #__users WHERE id = ' . $database->quote($this->userid));
$auctioneerEMAIL = $database->loadResult();
$database->setQuery('SELECT email
FROM #__bids AS b
LEFT JOIN #__users u
ON u.id = b.userid
WHERE
auction_id = ' . $database->quote($this->id) . '
AND accept = 1');
$result = $database->loadResultArray();
if (!empty($result)) {
$winnerEMAILs = implode(',', $result);
}
foreach ($userlist as $can) {
if (!$can->email) {
continue;
}
$userBid = $this->getBestBid($can->id);
// ? Issues or Multiple domains and want to link to a particular domain name?
// Replace JURI::root(). with the desired domain ex: 'http:://xy.com'.
$url = JUri::getInstance()->toString(array('scheme', 'host', 'port')) . JRoute::_('index.php?option=com_bids&task=viewbids&id=' . $this->id . ':' . JFilterOutput::stringURLSafe($this->title));
$patterns = array('%NAME%', '%SURNAME%', '%AUCTIONTITLE%', '%AUCTIONDESCR%', '%AUCTIONSTART%', '%AUCTIONEND%', '%AUCTIONLINK%', '%BIDPRICE%', '%AUCTIONEEREMAIL%', '%WINNEREMAIL%');
$replacements = array($can->name, @$can->surname, $this->title, $this->description, $this->start_date, $this->end_date, $url, isset($userBid->bid_price) ? $userBid->bid_price : 0, $auctioneerEMAIL, $winnerEMAILs);
$subj = str_replace($patterns, $replacements, $mail_body->subject);
$mess = str_replace($patterns, $replacements, $mail_body->content);
$mail = JMail::getInstance();
$mail->sendMail($mail_from, $site_name, $can->email, $subj, $mess, true);
}
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:61,代码来源:auction.php
示例18: jimport
/**
* Joomla!-specific function to get an instance of the mailer class
* @return JMail
*/
public function &getMailer()
{
jimport('joomla.mail.mail');
$sendmail = AEUtilJconfig::getValue('sendmail');
$smtpauth = AEUtilJconfig::getValue('smtpauth');
$smtpuser = AEUtilJconfig::getValue('smtpuser');
$smtppass = AEUtilJconfig::getValue('smtppass');
$smtphost = AEUtilJconfig::getValue('smtphost');
$smtpsecure = AEUtilJconfig::getValue('smtpsecure');
$smtpport = AEUtilJconfig::getValue('smtpport');
$mailfrom = AEUtilJconfig::getValue('mailfrom');
$fromname = AEUtilJconfig::getValue('fromname');
$mailer = AEUtilJconfig::getValue('mailer');
// Create a JMail object
$mail = JMail::getInstance();
// Default mailer is to use PHP's mail function
switch ($mailer) {
case 'smtp':
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "-- Using SMTP");
$mail->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
break;
case 'sendmail':
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "-- Using sendmail");
$mail->useSendmail($sendmail);
break;
default:
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "-- Using PHP email()");
$mail->IsMail();
break;
}
$mail->Encoding = '8bit';
$mail->CharSet = 'utf-8';
// Set default sender
$mail->setSender(array($mailfrom, $fromname));
return $mail;
}
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:40,代码来源:platform.php
示例19: createMailer
protected static function createMailer()
{
$input = JFactory::getApplication()->input;
$smtpauth = $input->get('smtp_auth', 0);
$smtpuser = $input->get('smtp_user', false, 'string');
$smtppass = $input->get('smtp_pass', false, 'string');
$smtphost = $input->get('smtp_host', false);
$smtpsecure = $input->get('smtp_secure', false);
$smtpport = $input->get('smtp_port', false);
$mailfrom = $input->get('from_email', false, 'string');
$fromname = $input->get('from_name', false);
$mailer = $input->get('mailer', false);
// Create a JMail object
$mail = JMail::getInstance();
// Set default sender without Reply-to
$mail->SetFrom(JMailHelper::cleanLine($mailfrom), JMailHelper::cleanLine($fromname), 0);
// Default mailer is to use PHP's mail function
switch ($mailer)
{
case 'smtp':
$mail->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
break;
case 'sendmail':
$mail->IsSendmail();
break;
default:
$mail->IsMail();
break;
}
return $mail;
}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:38,代码来源:emailconfigverifier.php
示例20: createMailer
/**
* Create a mailer object
*
* @return JMail object
*
* @see JMail
* @since 11.1
*/
protected static function createMailer()
{
$conf = self::getConfig();
$smtpauth = $conf->get('smtpauth') == 0 ? null : 1;
$smtpuser = $conf->get('smtpuser');
$smtppass = $conf->get('smtppass');
$smtphost = $conf->get('smtphost');
$smtpsecure = $conf->get('smtpsecure');
$smtpport = $conf->get('smtpport');
$mailfrom = $conf->get('mailfrom');
$fromname = $conf->get('fromname');
$mailer = $conf->get('mailer');
// Create a JMail object
$mail = JMail::getInstance();
// Clean the email address
$mailfrom = JMailHelper::cleanLine($mailfrom);
// Set default sender without Reply-to if the mailfrom is a valid address
if (JMailHelper::isEmailAddress($mailfrom)) {
// Wrap in try/catch to catch phpmailerExceptions if it is throwing them
try {
// Check for a false return value if exception throwing is disabled
if ($mail->setFrom($mailfrom, JMailHelper::cleanLine($fromname), false) === false) {
JLog::add(__METHOD__ . '() could not set the sender data.', JLog::WARNING, 'mail');
}
} catch (phpmailerException $e) {
JLog::add(__METHOD__ . '() could not set the sender data.', JLog::WARNING, 'mail');
}
}
// Default mailer is to use PHP's mail function
switch ($mailer) {
case 'smtp':
$mail->useSmtp($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
break;
case 'sendmail':
$mail->isSendmail();
break;
default:
$mail->isMail();
break;
}
return $mail;
}
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:50,代码来源:factory.php
注:本文中的JMail类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论